Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template<class T>
- class C
- {
- void common() { ... }
- void f2 = delete;
- };
- template<>
- class C<int>
- {
- void common() { ... }
- void f1() { ... }
- };
- template<class T>
- class C
- {
- void common() { ... }
- static_if(std::is_same<T, int>::value)
- {
- void f1( ) { ... }
- }
- else
- {
- void f2( ) = delete;
- }
- }
- struct S {};
- template<typename T>
- struct T
- static_if(is_same<T,int>::value) { : S } // ?
- { };
- template<typename T>
- struct T {};
- template<>
- struct T<int> : S {};
- template <typename To, typename From> struct ShapeCaster
- {
- static To & cast(From & x) { return dynamic_cast<To&>(x); }
- };
- template <> struct ShapeCaster<Triangle, Shape>
- {
- static Triangle & cast(Shape & x) { return static_cast<Triangle&>(x); }
- };
- template <typename To, typename From> To & shape_cast(From & x)
- {
- return ShapeCaster<To, From>::cast(x);
- }
- To & y = shape_cast<To>::cast(x);
- template<typename, typename>
- struct is_same{
- static constexpr bool value = false;;
- };
- template<typename T>
- struct is_same<T, T>{
- static constexpr bool value = true;;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement