/* @copyright Louis Dionne 2014 Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) */ #include #include namespace Comparable_operators { template std::string operator==(T t, U u) { return "=="; } template std::string operator!=(T t, U u) { return "!="; } struct enable { }; } struct Comparable { using operators = Comparable_operators::enable; }; namespace Monad_operators { template std::string operator>>=(M m, F f) { return ">>="; } struct enable { }; } struct Monad { using operators = Monad_operators::enable; }; template struct enable_adl : T... { }; template using operators = enable_adl; struct Foo : operators { }; int main() { Foo a, b; assert((a == b) == "=="); assert((a != b) == "!="); assert((a >>= b) == ">>="); }