Boost logo

Boost :

From: David B. Held (dheld_at_[hidden])
Date: 2002-10-03 00:23:56


#define USE_IF 1
#include <boost/mpl/if.hpp>
//--------------------------------------------------------------------------
-
template <typename T>
class ptr
{
    typedef ptr this_type;
#if USE_IF
    typedef boost::mpl::if_c<false, this_type const, this_type const>::type
        copy_arg;
#else
    typedef this_type const copy_arg;
#endif
public:
    ptr() { }
    ptr(copy_arg& p)
    {
        p = p;
    }
};

int main(int argc, char* argv[])
{
    ptr<int> p;
    ptr<int> q(p);
}

With concrete types, if_<> works just fine on bcc. However, with
dependent names, it strips cv qualifiers (apparently. This can be
demonstrated by replacing this_type with T (same action) or int
(correct behaviour...assuming you modify the example appropriately,
of course). Any advice on how to get this important construct
working would be appreciated. I think that in general, bcc is a
bit weak with dependent names (they break template templates,
in particular).

Dave


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