1 // Copyright 2015-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_MAKE_DEFAULT_HPP 8 #define BOOST_HISTOGRAM_DETAIL_MAKE_DEFAULT_HPP 9 10 namespace boost { 11 namespace histogram { 12 namespace detail { 13 14 template <class T> 15 T make_default_impl(const T& t, decltype(t.get_allocator(), 0)) { 16 return T(t.get_allocator()); 17 } 18 19 template <class T> make_default_impl(const T &,float)20T make_default_impl(const T&, float) { 21 return T{}; 22 } 23 24 template <class T> make_default(const T & t)25T make_default(const T& t) { 26 return make_default_impl(t, 0); 27 } 28 29 } // namespace detail 30 } // namespace histogram 31 } // namespace boost 32 33 #endif 34