From: Andy Little (andy_at_[hidden])
Date: 2004-07-07 04:02:35
"Andy Little" <andy_at_[hidden]> wrote
David Abrahams wrote
> > Arkadiy's typeof from the Boost Files area at yahoogroups:
> > http://tinyurl.com/32mlf
(BTW tinyurl died when I tried it direct... look for typeof.zip on boost
> > No docs, lots of examples.
It has some docs , which are entirely adequate to get you going IMO.
> Thanks... I'll take a look.
Well . I've tested it and am pleased to report that it works well .. test
code at the end.
In relation to my physical_quantities library when you want a temporary, by
the time you've registered it
it may simpler to use the result_of approach, where there is no requirement
to register. But that is a problem particular to my library where new types
of unknown origin are being computed all the time in a calculation. IOW you
need result_of to compute typeof as in code below.
Whatever... it does the job well. .. worth a look.
//Note: not available in pqs-1-01-04
#define BOOST_TYPEOF_REGISTRATION_GROUP \
// required because a temporary result of calc
// is not same signature as q_velocity::m_div_s in pqs-2-00-01
using namespace pqs;
// dummy function return test
return q_length::m(1) / q_time::s(1);
std::cout << v <<'\n';
std::cout << f1 <<'\n';
q_velocity::m_div_s v1 = my_func1();
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk