Boost logo

Boost :

From: Fernando Cacciola (fcacciola_at_[hidden])
Date: 2001-09-27 09:11:17

----- Original Message -----
From: Douglas Gregor <gregod_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Thursday, September 27, 2001 10:36 AM
Subject: Re: [boost] tuple's 'ignore' question

> On Thursday 27 September 2001 09:10, you wrote:
> > Unfortunately, ignore is already using form one:
> > Here is a transcript of the (original) code:
> >
> > // "ignore" allows tuple positions to be ignored when using "tie".
> > namespace {
> > detail::tuples::swallow_assign ignore;
> > }
> >
> > Only a explicit 'extern' keyword would solve the problem, but then I
> > have to define the variable somewhere else. Not a good thing to do.
> There's nothing really wrong with this solution, I would just like to see
> common solution for all of Boost so that users don't need to poke around
> library source.
Technically, you're right. But to actually do this we need to set up a
common mechanism:
One way would be to allow boost libraries to distribute .cpp files too, that
the user MUST add to the project using the library.
Another way would be to distribute *static* libraries (.lib) and insert them
programatically via #pragma.

The first choice requires some way to allow the identifier to be visible
outside a particular dynamic/shared library, typically acomplished with some
sort of export keyword. Unfortunately, dynamic/shared library issues are not
standarized, so this would require help from config.hpp, something like
BOOST_SHARED_IDENTIFIER. Also, it should be properly documented that the
user must add source.cpp to his/her project for the library to work.

The second choice is OK as long as the libraries inserted are totally
static; otherwise the user would have to deal with an additional
dynamic/shared library to distribute to the customer, which is problematic.
This has the drawback that the library would need a build system to allow
the user to create the lib in his/her enviroment.

For small needs, such as a couple of global variables or functions, I would
use choice one: just a .cpp that the user must add somewhere.
For bigger libraries, I would use choice two, provided a build system is
distributed along so the user can create the static lib.

> > > > BTW: In which namespace is 'ignore' supposed to go? I'm confused...
> > > > Borland is confused because it puts ignore in boost)
> > >
> > > It should be in an anonymous namespace inside boost::tuples. That way
> > > "copy" exists per translation unit, so we don't have to deal with
> > > careful to define it in only one translation unit.
> >
> > "boost::tuples" was what I expected, but it is in "boost" (without
> > 'tuples') But that's fine!!!
> > I just got confused because in the review version I was familiar with
> > everything went into boost::tuples, but in this release, it is in
> The names have moved around a bit. 'ignore' is back in boost::tuples now.
I see.
Seems like I should get the library from CVS.

Fernando Cacciola
Sierra s.r.l.

Boost list run by bdawes at, gregod at, cpdaniel at, john at