Boost logo

Boost Users :

From: Hansi (hansipet_at_[hidden])
Date: 2008-05-23 03:55:43


Hello,

I want to use the BOOST_MPL_ASSERT Macro inside a struct (compiler is
MSVC2005)

#include <boost/mpl/assert.hpp>
#include <boost/type_traits.hpp>

template<typename Value>
struct Getter
{
        typedef std::wstring result_type;
                        
        BOOST_MPL_ASSERT(( boost::is_fundamental< Value > ));
                        
        std::wstring operator()(const Value* val)const
        {
                return boost::lexical_cast<std::wstring>(*val);
        }

        std::wstring operator()(typename
boost::call_traits<Value>::const_reference val)const
        {
                return boost::lexical_cast<std::wstring>(val);
        }
};

Here I get allways the following error:

Error 1 error C2664: 'boost::mpl::assertion_failed' : cannot convert
parameter 1 from 'boost::mpl::failed
************boost::is_fundamental<T>::* ***********' to
'boost::mpl::assert<false>::type' Utils.h 32

Error 2 error C2866:
'Microtec::Viewer::Getter<Value>::mpl_assertion_in_line_32' : a const
static data member of a managed type must be initialized at the point
of declaration Utils.h 32

Inside the function it works fine..
Has anyone an idea how I can solve that?

Best regards
Hansjörg


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net