Boost logo

Boost Users :

From: Stephen Gross (mrstephengross_at_[hidden])
Date: 2005-06-15 10:49:02

I'm trying to find a way to see if a given object is convertible to
std::string, but with certain restrictions. Normally, is_convertible<> would
be fine, but in this case it doesn't work for my needs.

Here's the situation in more detail. I've got a class Foo with a string
conversion operator:

class Foo { public: operator std::string () const; };

I want some kind of is_convertible<Foo, std::string> to return FALSE, but
something like is_convertible<char*, std::string> to return TRUE. Basically,
I want is_convertible to check to see if the target type (std::string) has
an implicit constructor taking the input type; I *don't* want is_convertible
to check to see if the input type has a conversion-to-target-type function.

Is there a way to do this?


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at