Boost logo

Boost :

From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2002-11-02 23:01:05


"Joel de Guzman" <djowel_at_[hidden]> wrote in message
news:022e01c28228$c1fa3c20$0100a8c0_at_kim...

> > By the way, what are the objections against our current approach? One,
as I
> > understand, the need for macro. Another is that boost::tuple is already
> > widely used throughout the library. Anything else?
>
> I'd say primarily the macro. The tuple is secondary. As I said,
> macros such as COLUMN are sure to clash with existing code.
> In a multi-library package such as boost, the convention
> is to prefix it with BOOST_LIBRARY_NAME_. Thus, your
> column macro will be something like
>
> BOOST_LIBRARY_NAME_COLUMN.
>
> and
>
> BOOST_LIBRARY_NAME_FIELD
>
> Ahh, the namespace "rel" I think is too short for a library and
> can potentially clash.

By the way, I think the 1st macro is less problematic than the 2nd one. The
COLUMN macro is used for declarations, so, if we see something like
following (we would like the name RTL, which maybe too ambitious :o) ):

BOOST_RTL_COLUMN(ssn, int);
BOOST_RTL_COLUMN(name, std::string);
etc.

this looks pretty much OK to me.

On the other hand, the following is plain ugly:

BOOST_RTL_FIELD(employee, age) = BOOST_RTL_FIELD(employee, date_of_birth) -
today();

I would like to achieve the following:

employee.field<age>() = employee.field<date_of_birth>() - today();

but neither MSVC6 nor g++ allow me to do it. Is there anything in the
standard that prohibits to explicitly specify template parameters on member
function templates?

The next closest thing would be:

employee(age()) = employee(date_of_birth()) - today(); // pass by reference

but I am not sure whether the compilers would be able to optimize away the
creation of unnecessary temporary object.

Arkadiy


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