|
Boost Users : |
From: jono (jp_at_[hidden])
Date: 2007-11-17 00:24:38
hi all,
i've got 2 classes like this....
//=================================
struct Symbol : private std::string
{
public:
Symbol(const char *cp):std::string(cp){}
~Symbol(){}
};
struct String : private std::string
{
public:
String(const String &s):std::string(s.c_str()){}
String(const char *cp):std::string(cp){}
~String(){}
};
//=================================
//
// and i'm trying to compile this....
//
//=================================
template<BinaryOp op, typename ObjectT>
Object binary_op(const ObjectT &arg1, const ObjectT &arg2)
{
return undefined;
}
template<BinaryOp op>
class BinaryOpVisitor : public boost::static_visitor<Object>
{
public:
template<typename ObjectT, typename ObjectU>
Object operator()( const ObjectT &arg0, const ObjectU &arg1) const
{
bool const y = boost::is_convertible<ObjectT, ObjectU>::value;
return undefined;
}
template<typename ObjectT>
Object operator ()(const ObjectT &arg0, const ObjectT &arg1) const
{
return binary_op<op, ObjectT>(arg0, arg1);
}
};
//=================================
//
// but using msvc 7.1 i'm getting the following error...
//
// s:\lib\boost_1_33_1\boost\type_traits\is_convertible.hpp(202) :
// error C2243: 'type cast' : conversion from 'Symbol *__w64 ' to
'const std::basic_string<_Elem,_Traits,_Ax> &' exists, but is inaccessible
//
//
//=================================
// is_convertible.hpp(202) is as follows ...
BOOST_STATIC_CONSTANT(bool, value =
sizeof( _m_check(_m_from) ) ==
sizeof(::boost::type_traits::yes_type)
);
//=================================
//
//
// how do i tell (deceive?) the compiler that the conversion does not
exist?
cheers,
jono poff
day-one digital
auckland, nz
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