|
Boost : |
From: Manfred Doudar (manfred.doudar_at_[hidden])
Date: 2004-11-15 03:35:28
Thanks Jeff, I take a look down that path
Cheers,
-- Manfred MetOcean Engineers Jeff Garland wrote: >On Mon, 15 Nov 2004 10:35:35 +0800, Manfred Doudar wrote > > >>c/- All: >> >>In taking a holistic look at some of the work I do, I've come >>to realize a need for a "transparent" data type, and wondering >>whether or not it exists. >> >>As all of you would have experienced, any organization has such >>a representation of such a type; be it called: >> >> "Null value", "Missing value", "Fill value", "Infinity" , >> >>or whatever. >> >>What I am hoping for is support for such an representation, >>with existing containers and algorithms; such that if you >>perform any mathematical operation, (arithmetic, transcendental; >>inverse; anything really ...); that you get back the *same* >>object (ie. it passes transparently through any operation), and >>not raise any exception if you so choose. >> >> Example: >> >> missing_val == atan(missing_val) - missing_val; >> missing_val == 1 / missing_val; >> missing_val == missing_val + missing_val; >> missing_val == missing_val - missing_val; >> >> typedef std::vector<any_type> dVec; >> dVec some_vector; >> >> ... populate some_vector ... >> >> dVec::iterator = some_vector.find(missing_val); >> >>Boosters, do we have such a representation; is there value in having >>such a thing in Boost; is there a (simple) alternative work-around ?? >> >> > >In date-time there is a template called int_adapter in the implementation that >lets you have nan, infinities, etc in an integer value type. I think this is >something like what you are trying to do. Basically it steals some values >from the integer type and treats them as special then overrides the operators >accordingly. We use this to implement operations on date-time special values >like not-a-date-time. > >See boost/date_time/int_adapter and libs/date_time/test/testint_adapter.cpp >for details. > >HTH, > >Jeff >_______________________________________________ >Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost > > >
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk