Boost logo

Boost :

From: M G (g_at_markus_at_[hidden])
Date: 2004-06-03 08:17:12


Greetings BOOST developers,

the "Named Variable Lib" is a lightweight macro &
template library which allows you to write:

os << NV(character) << NV(std_string);
os << NV(array_char_text) << NV(array_char_null);
os << NV(p_float)<< NVP(p_float);
p_float = 0;
os << NVP(p_float);
os << NV(the_answer_over_pi);
os << NVB(((p_device==0) || f > 1.2) &&
name=="rsd0a");

to get e.g.

 character='A' std_string="test"
 array_char_text[]="text" array_char_null=NULL
 p_float=0012FD9C *p_float=1.234
 p_float=NULL
 the_answer_over_pi=13.36901522
 (((p_device_name==0) || f > 1.2) && name=="rsd0a")=1

written to the std::ostream os (" << std::endl" in C++
source omitted for better readability).

Its main goal is to standardize the 5 macros
NV,NVP,NVB,NVM,NVMP to let one output
variable/expression together with their names
conveniently (just one very short macro per
expression) and safely (e.g. prevents
os << "x1=" << x2;).

Apart from that the NV concept could be used for other
applications, where one needs a variable/expression
and its name as a string.

For more info & download of the library goto
http://groups.yahoo.com/group/boost/files/Named%20Variable/

Feel free to try & comment ;-)
Markus

        
                
__________________________________
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk