Martin Hořeňovský | 73159ac | 2017-02-09 12:57:01 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Created by Martin on 08/02/2017. |
| 3 | * |
| 4 | * Distributed under the Boost Software License, Version 1.0. (See accompanying |
| 5 | * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
| 6 | */ |
| 7 | #ifndef TWOBLUECUBES_CATCH_TYPE_TRAITS_HPP_INCLUDED |
| 8 | #define TWOBLUECUBES_CATCH_TYPE_TRAITS_HPP_INCLUDED |
| 9 | |
| 10 | #if defined(CATCH_CONFIG_CPP11_TYPE_TRAITS) |
| 11 | #include <type_traits> |
| 12 | #endif |
| 13 | |
| 14 | |
| 15 | namespace Catch { |
| 16 | |
| 17 | #if defined(CATCH_CONFIG_CPP11_TYPE_TRAITS) |
| 18 | |
| 19 | template <typename T> |
| 20 | using add_lvalue_reference = std::add_lvalue_reference<T>; |
| 21 | |
| 22 | template <typename T> |
| 23 | using add_const = std::add_const<T>; |
| 24 | |
| 25 | #else |
| 26 | |
| 27 | template <typename T> |
| 28 | struct add_const { |
| 29 | typedef const T type; |
| 30 | }; |
| 31 | |
| 32 | template <typename T> |
| 33 | struct add_lvalue_reference { |
| 34 | typedef T& type; |
| 35 | }; |
| 36 | template <typename T> |
| 37 | struct add_lvalue_reference<T&> { |
| 38 | typedef T& type; |
| 39 | }; |
| 40 | // No && overload, because that is C++11, in which case we have |
| 41 | // proper type_traits implementation from the standard library |
| 42 | |
| 43 | #endif |
| 44 | |
| 45 | } |
| 46 | |
| 47 | #endif // TWOBLUECUBES_CATCH_TYPE_TRAITS_HPP_INCLUDED |