converting two types according to their typeid
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: converting two types according to their typeid

  1. #1
    Join Date
    May 2010
    Posts
    34

    Question converting two types according to their typeid

    Hello,

    boost::is_convertible<From, To> does it for types.
    I need it for typeid's.
    Meaning, is there a way to know if two types are convertible according to their typeid.

    struct B {
    B(const A& a) {}
    };

    struct A {};

    boost::is_convertible<A,b>::value --> will be true.

    i need something like this:

    A a;
    B b;

    Is_Convertible(typeid(a),typeid(b));

    Thanks

  2. #2
    Join Date
    Jul 2005
    Location
    Netherlands
    Posts
    2,016

    Re: converting two types according to their typeid

    Quote Originally Posted by subkin13 View Post
    boost::is_convertible<From, To> does it for types.
    I need it for typeid's.
    Meaning, is there a way to know if two types are convertible according to their typeid.
    typeid is a global function. I guess you mean "... according to the type_info returned by typeid". In that case, no type_info does not contain information like that. See http://www.cplusplus.com/reference/s...nfo/type_info/.
    Cheers, D Drmmr

    Please put [code][/code] tags around your code to preserve indentation and make it more readable.

    As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center