[utility] BOOST_IDENTITY_TYPE drops const-ness of value types
Looks like const value types, once passed thru BOOST_IDENTITY_TYPE, "becomes" non-const. Like so: // Attempt to implement a multi-argument utility macro, where arguments are // types, parenthesized only when required (by the user, when type has commas) #define ASSERT_EQUAL( t1, t2 ) \ static_assert( std::is_same< \ BOOST_IDENTITY_TYPE((t1)), BOOST_IDENTITY_TYPE((t2)) \ >::value, #t1 " not same as " #t2) // sanity check: static_asserts as expected ASSERT_EQUAL( int, double ); // sanity check: static_assert as expected for types with commas ASSERT_EQUAL( (std::pair<int, double>), (std::pair<double, int>) ); // Here is the failure: this is expected to assert but it doesnt! ASSERT_EQUAL( const int, int );
From the implementation of BOOST_IDENTITY_TYPE, it is clear why this is happening, as the function signature is independent of const-ness of value type.
Is this a bug? Or is this not the way BOOST_IDENTITY_TYPE is supposed to be used? Nick
participants (1)
-
Nick Stokes