• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2019 Hans Dembinski
2 //
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt
5 // or copy at http://www.boost.org/LICENSE_1_0.txt)
6 
7 #ifndef BOOST_HISTOGRAM_DETAIL_REPLACE_TYPE_HPP
8 #define BOOST_HISTOGRAM_DETAIL_REPLACE_TYPE_HPP
9 
10 #include <boost/core/use_default.hpp>
11 #include <string>
12 #include <type_traits>
13 
14 namespace boost {
15 namespace histogram {
16 namespace detail {
17 
18 template <class T, class From, class To>
19 using replace_type = std::conditional_t<std::is_same<T, From>::value, To, T>;
20 
21 template <class T, class Default>
22 using replace_default = replace_type<T, boost::use_default, Default>;
23 
24 template <class T>
25 using replace_cstring = replace_type<T, const char*, std::string>;
26 
27 } // namespace detail
28 } // namespace histogram
29 } // namespace boost
30 
31 #endif
32