Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:43:43

0001 // Copyright 2021 Hans Dembinski
0002 //
0003 // Distributed under the Boost Software License, version 1.0.
0004 // (See accompanying file LICENSE_1_0.txt
0005 // or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 
0007 #ifndef BOOST_HISTOGRAM_ACCUMULATORS_IS_THREAD_SAFE_HPP
0008 #define BOOST_HISTOGRAM_ACCUMULATORS_IS_THREAD_SAFE_HPP
0009 
0010 #include <boost/histogram/detail/priority.hpp>
0011 #include <boost/histogram/fwd.hpp>
0012 #include <type_traits>
0013 
0014 namespace boost {
0015 namespace histogram {
0016 namespace detail {
0017 
0018 template <class T>
0019 constexpr bool is_thread_safe_impl(priority<0>) {
0020   return false;
0021 }
0022 
0023 template <class T>
0024 constexpr auto is_thread_safe_impl(priority<1>) -> decltype(T::thread_safe()) {
0025   return T::thread_safe();
0026 }
0027 
0028 } // namespace detail
0029 
0030 namespace accumulators {
0031 
0032 template <class T>
0033 struct is_thread_safe
0034     : std::integral_constant<bool,
0035                              detail::is_thread_safe_impl<T>(detail::priority<1>{})> {};
0036 
0037 } // namespace accumulators
0038 } // namespace histogram
0039 } // namespace boost
0040 
0041 #endif