Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2004-11-15 13:35:29


Rene Rivera wrote:

[...]

> #include <boost/named_params.hpp>
>
> struct name_t; // tag types
> struct value_t;
>
> namespace {
> boost::keyword<name_t> name; // keyword objects

    boost::keyword<struct name_t> name;

is even better. ;-)

> boost::keyword<value_t> value;
> }
>
> template<class Params>
> inline void foo(const Params& params)
> {
> foo(params[name],params[value]);
> }
>
> int main()
> {
> foo((name = "bar", value = 3.14f));
> foo((value = 5.2f, name = "baz"));
>
> return 0;
> }

FWIW, I also like this style.


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