Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
INHERIT_CTORS default constructor
//Title of this code //clang 3.6.0 #include <iostream> #include <type_traits> #define INHERIT_CTORS( Derived, Base ) \ template< typename T0, std::enable_if_t< \ ( std::is_same< Base, std::decay_t<T0> >::value || \ !std::is_base_of< Base, std::decay_t<T0> >::value ) && \ std::is_convertible< T0 &&, Base >::value \ >* =nullptr> \ Derived( T0 && t0 ) \ : Base( std::forward<T0>(t0) ) {} \ template< typename T0, std::enable_if_t< \ ( std::is_same< Base, std::decay_t<T0> >::value || \ !std::is_base_of< Base, std::decay_t<T0> >::value ) && \ !std::is_convertible< T0 &&, Base >::value \ >* =nullptr> \ explicit Derived( T0 && t0) \ : Base( std::forward<T0>(t0) ) {} \ template< typename T0, typename T1, typename ...Ts > \ explicit Derived( T0 && t0, T1 && t1, Ts && ... ts ) \ : Base( std::forward<T0>(t0),std::forward<T1>(t1),std::forward<Ts>(ts)... ) {} struct S { }; struct T { INHERIT_CTORS(T, S) }; int main() { T t; std::cout << "Hello, world!\n"; }
run
|
edit
|
history
|
help
0
Division by zero exception example
HexDong
function returning a function demo
Program_3
hello world
mpi_distributed_sort
Combination
Saam hash example
11/18
illegal instruction (SIGILL)