Class which wraps int and have no explicit or implicit conversions.
| 14 | |
| 15 | // Class which wraps int and have no explicit or implicit conversions. |
| 16 | struct IntWrapper { |
| 17 | int get() const { |
| 18 | return value; |
| 19 | } |
| 20 | static IntWrapper create(int v) { |
| 21 | return IntWrapper(v); |
| 22 | } |
| 23 | |
| 24 | private: |
| 25 | explicit IntWrapper(int v) : value(v) {} |
| 26 | int value; |
| 27 | }; |
| 28 | |
| 29 | // Need for SFINAE-based specialization testing. |
| 30 | template<typename T> struct IsIntWrapper : std::false_type {}; |