1 | |
2 | // Copyright (C) 2009-2012 Lorenzo Caminiti |
3 | // Distributed under the Boost Software License, Version 1.0 |
4 | // (see accompanying file LICENSE_1_0.txt or a copy at |
5 | // http://www.boost.org/LICENSE_1_0.txt) |
6 | // Home at http://www.boost.org/libs/local_function |
7 | |
8 | #ifndef ADDABLE_HPP_ |
9 | #define ADDABLE_HPP_ |
10 | |
11 | #include <boost/concept_check.hpp> |
12 | |
13 | template<typename T> |
14 | struct Addable { // User-defined concept. |
15 | BOOST_CONCEPT_USAGE(Addable) { |
16 | return_type(x + y); // Check addition `T operator+(T x, T y)`. |
17 | } |
18 | |
19 | private: |
20 | void return_type(T) {} // Implementation (required for some linkers). |
21 | static T const& x; |
22 | static T const& y; |
23 | }; |
24 | |
25 | #endif // #include guard |
26 | |
27 | |