Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- template <typename T>
- struct Bad {
- friend std::ostream& operator <<(std::ostream& os, const Bad<T>& a);
- };
- template <typename T>
- std::ostream& operator <<(std::ostream& os, const Bad<T>& bad) {
- (void)bad;
- return os << "i'm bad";
- }
- template <typename T>
- struct Ok {
- template <typename X>
- friend std::ostream& operator <<(std::ostream& os, const Ok<X>& a);
- };
- template <typename T>
- std::ostream& operator <<(std::ostream& os, const Ok<T>& ok) {
- (void)ok;
- return os << "i'm ok";
- }
- int main() {
- std::cout << Ok<int>() << std::endl;
- //std::cout << Bad<int>() << std::endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement