Is there a difference in usage between defining a tag type as an anonymous empty structure or an empty structure?
using A = struct {}; struct B {};
In my mind, the only difference is the βeffectiveβ type name when some kind of reflection is used (ie __PRETTY_FUNCTION__ , <cxxabi.h>:abi::__cxa_demangle(typeid().name()) , etc. )
ADL works in both directions:
namespace ns { using A = struct {}; struct B {}; constexpr bool adl(A) { return true; } constexpr bool adl(B) { return true; } } template< typename type > constexpr bool adl(type) { return false; } static_assert(adl(ns::A{})); static_assert(adl(ns::B{}));
c ++ c ++ 11 tags c ++ 14
Orient
source share