Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-06-06 03:13:35


Hi,
I get program_options failures on VC 7.0 that result from the following
sequences of events:

   variable_map::as<string> is called
   any_cast<string&> is called
   the following code in any.hpp gives static assertion:

     typedef BOOST_DEDUCED_TYPENAME remove_reference<ValueType>::type
            nonref;

#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
        // If 'nonref' is still reference type, it means the user has not
        // specialized 'remove_reference'.

        // Please use BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION macro
        // to generate specialization of remove_reference for your class
        // See type traits library documentation for details
        BOOST_STATIC_ASSERT(!is_reference<nonref>::value);

The problem is that on VC 7.0 specializations for remove_reference must be
defined explicitly, and it's not done for string and wstring.

I see three choices:

1. Declare specialization for string and wstring in program_options
2. Declare them somewhere in type_traits
3. Mark 7.0 as unsupported.
4. Don't use any_cast to reference type

I don't like (4) because I've introduced cast to reference myself explicitly
for program_options sake. (1) can lead to conflicts with user code. So it
leaves (2) and (3). Any opinions which one is better?

- Volodya


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