Boost logo

Boost Users :

From: Hansi (hansipet_at_[hidden])
Date: 2008-05-27 08:35:21


Hello,

I have implemented the following template:

template<typename Value>
struct Validator
{
        typedef bool result_type;
                        
        bool operator()(const std::wstring& newVal)const
        {
                boost::lexical_cast<typename Value>(newVal);
                return true;
        }
};

now here is the problem that for pointers the lexical cast doesn't work.
I have now made the following declaration:

boost::lexical_cast<boost::mpl::if_< boost::is_pointer<typename
Value>,
        boost::remove_pointer<typename Value>::type,
        typename Value>>::type>(newVal);

It works now for pointers too, but now I have the problem with the char
type. First I have made a specialization for this type. Is it here also
possible to make only one specialization or have I to provide both for
pointer and value?

Is there another way to solve that problem?

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