mirror of
https://github.com/boostorg/core.git
synced 2025-05-09 14:57:46 +00:00
Fix type_name for abstract classes. Fixes #172.
This commit is contained in:
parent
d03e58b77e
commit
965508d9e1
@ -103,7 +103,8 @@ inline std::string fix_typeid_name( char const* n )
|
||||
}
|
||||
|
||||
// class types can be incomplete
|
||||
template<class T> std::string typeid_name_impl( int T::* )
|
||||
// but also abstract (T[1] doesn't form)
|
||||
template<class T> std::string typeid_name_impl( int T::*, T(*)[1] )
|
||||
{
|
||||
std::string r = fix_typeid_name( typeid(T[1]).name() );
|
||||
return r.substr( 0, r.size() - 4 ); // remove ' [1]' suffix
|
||||
@ -116,7 +117,7 @@ template<class T> std::string typeid_name_impl( ... )
|
||||
|
||||
template<class T> std::string typeid_name()
|
||||
{
|
||||
return typeid_name_impl<T>( 0 );
|
||||
return typeid_name_impl<T>( 0, 0 );
|
||||
}
|
||||
|
||||
// template names
|
||||
|
@ -55,6 +55,13 @@ template<class T1, class T2> struct X
|
||||
|
||||
template<class T1, class T2> struct Y;
|
||||
|
||||
class W
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void f() = 0;
|
||||
};
|
||||
|
||||
enum E1
|
||||
{
|
||||
e1
|
||||
@ -122,6 +129,7 @@ int main()
|
||||
TEST(A);
|
||||
TEST(B);
|
||||
TEST(C);
|
||||
TEST(W);
|
||||
|
||||
TEST(E1);
|
||||
|
||||
@ -143,6 +151,9 @@ int main()
|
||||
TEST(C&);
|
||||
TEST(C const&);
|
||||
|
||||
TEST(W const);
|
||||
TEST(W&);
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
|
||||
TEST(B&&);
|
||||
@ -156,6 +167,8 @@ int main()
|
||||
TEST(C*);
|
||||
TEST(C const* volatile*);
|
||||
|
||||
TEST(W volatile*);
|
||||
|
||||
TEST(void*);
|
||||
TEST(void const* volatile*);
|
||||
|
||||
@ -307,6 +320,8 @@ int main()
|
||||
|
||||
TEST(std::pair<C, C>);
|
||||
|
||||
TEST(std::pair<W, W>);
|
||||
|
||||
TEST(std::pair<void, void>);
|
||||
TEST(std::pair<std::pair<void, void>, void>);
|
||||
|
||||
@ -336,9 +351,11 @@ int main()
|
||||
TEST(X<A const&, B&> volatile&);
|
||||
|
||||
TEST(X<C, C>);
|
||||
TEST(X<W, W>);
|
||||
|
||||
TEST(Y<A, B>);
|
||||
TEST(Y<C, C>);
|
||||
TEST(Y<W, W>);
|
||||
|
||||
TEST(X<std::pair<void, void>, void>);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user