Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<type_traits>
- template <typename T>
- class bazplate {
- public:
- template<class Q = T>
- typename std::enable_if<std::is_same<Q, void>::value, int> ::type foo();
- template<class Q = T>
- [[nodiscard]] typename std::enable_if<!std::is_same<Q, void>::value, int> ::type foo();
- };
- template <typename T>
- int bazplate<T>::foo (){
- return 3;
- }
- int main(){
- bazplate<int> a;
- bazplate<void> b;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement