1 // Copyright 2019 Hans Dembinski
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)
7 #ifndef BOOST_HISTOGRAM_DETAIL_REPLACE_TYPE_HPP
8 #define BOOST_HISTOGRAM_DETAIL_REPLACE_TYPE_HPP
10 #include <boost/core/use_default.hpp>
12 #include <type_traits>
18 template <class T, class From, class To>
19 using replace_type = std::conditional_t<std::is_same<T, From>::value, To, T>;
21 template <class T, class Default>
22 using replace_default = replace_type<T, boost::use_default, Default>;
25 using replace_cstring = replace_type<T, const char*, std::string>;
28 } // namespace histogram