Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2001-09-26 22:14:11

On Wednesday 26 September 2001 01:45, you wrote:
> Here comes a 'user' post:
> I've recently started to use the tuple library to change some old code in
> one of my projects.
> Tuples are used by some headers that at some point must be precompiled
> (otherwise compilation time will be prohibiting);
> but with Borland 5.5.1 the header 'tuple_basic.hpp' cannot be included in a
> precompiled header due to the static global variable 'ignore'.
> Is there any workaround?

"ignore" could be marked extern instead of static, then defined elsewhere.
Now that Boost has a build system it might be logical to have a macro

that will be either:
namespace {

  extern declaration;

The former will be used if only Boost headers are being used, whereas the
latter will be used if the Boost libraries are compiled and contain the
definitions for these objects.

> The thing I HAD to do in order to go on was to change 'ignore' from a
> global variable into a free function, but of course this changes the
> semantics.

Only the type of ignore matters, so you really won't be changing semantics at
all; just the syntax.

> BTW: In which namespace is 'ignore' supposed to go? I'm confused... (or
> Borland is confused because it puts ignore in boost)

It should be in an anonymous namespace inside boost::tuples. That way one
"copy" exists per translation unit, so we don't have to deal with being
careful to define it in only one translation unit.


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