Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
template specialization inheritance problem
//clang 3.8.0 #include <iostream> using namespace std; struct A { A() {} }; struct B : public A { B() {} }; template <typename T> struct X{ X(T& t) { cout << "X\n"; } }; template <> struct X<A> { X(A& a) { cout << "XA\n"; } }; int main() { cout << boolalpha; cout << is_base_of<A, A>::value << endl; cout << is_base_of<A, B>::value << endl; A a; B b; A& ra = b; X<A> xa(a); X<B> xb(b); X<A> xra(ra); }
run
|
edit
|
history
|
help
0
hello world 3
C++ Standard Template Library
pointer to pointer
Exploring stringstreams
STL stack
Standard Template Library
mine
Optional conversions
Find in vector vs unordered_map
Dequeue Array-Based Example