boostorg/type_traits — pull request #7 by igaztanaga (2014-08-26 21:34:38+00:00)
Title: is_copy_assignable implementation added.

If I haven't done something incorrectly when creating this pull request, this adds boost::is_copy_assignable trait.

I've roughly followed boost::is_copy_constructible implementation and tests as a guide.

boost::is_copy_assignable can't be correctly implemented unless deleted expreesion and SFINAE are available. One possible implementation is:

template< class T>
struct is_copy_assignable
: std::is_assignable< typename std::add_lvalue_reference::type,
typename std::add_lvalue_reference::type> {};

which is translated in the implementation to a test to see if the expression:

declval() = declval()

is well formed.

For non-conforming/old compilers arrays, const element types, types derived from noncopyable or tagged with BOOST_MOVEABLE_BUT_NOT_COPYABLE are detected as non-assignable. Otherwise they are declared as copy assignable.

Compiled in several MSVC, GCC and Clang compilers.