How does Stroustrup's Can_Copy template work?

后端 未结 4 687
野趣味
野趣味 2020-12-19 08:49

Stroustrup provides a Can_copy template. How does it work?

template struct Can_copy {
    static void constraints(T1 a, T2 b) { T2          


        
4条回答
  •  悲&欢浪女
    2020-12-19 09:23

    Meant to be informative, not an answer (not deserving of an upvote):

    In C++0x you will have improved facilities for this in the header .

    std::is_copy_constructible::value;
    std::is_copy_assignable::value;
    std::is_constructible::value;
    std::is_assignable::value;
    std::is_convertible::value;
    

    http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3225.pdf

    search for "[meta]".

提交回复
热议问题