Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2002-05-23 08:00:37


On Tuesday 21 May 2002 05:24 pm, Thomas Witt wrote:
> The problem is there is no keyword "signals" in C++, so what to do?
> Easy, first parse the code by a prepreprocessor called moc, then use the
> cpp to remove the non-c++ keyword. How?, just #define signals protected.

How rude (said in my best C3PO voice).

[snip]
> Any idea how to work around this problem?

I can't think of a good general solution.

We can't just replace the 'signals' namespace with a (user-defined, but
defaulted) macro BOOST_SIGNALS_NAMESPACE because that doesn't play nicely
with (shared) libraries.

Here's a possibility: the Signals library moves from the boost::signals
namespace to the boost::signalslib namespace (better names anyone? please?).
Then the Signals library also has this:

#ifndef signals
namespace boost {
  namespace signalslib {}
  namespace signals = signalslib;
}
#endif

So when Qt is not available, the boost::signals namespace alias is used and
nobody knows the difference (would someone confirm this? I haven't needed
namespace aliases before...). However, when Qt is available and is rudely
smashing unprefixed, short, lower-cased tokens, the namespace
boost::signalslib can be used instead. And because everything is in terms of
'signalslib', there are no ugly naming problems

As for the moc keyword 'slots', I can just use a wart like '_slots' to avoid
the issue.

        Doug


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