Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:33:50

0001 /*
0002  * Distributed under the Boost Software License, Version 1.0.
0003  * (See accompanying file LICENSE_1_0.txt or copy at
0004  * http://www.boost.org/LICENSE_1_0.txt)
0005  *
0006  * Copyright (c) 2020-2021 Andrey Semashev
0007  */
0008 /*!
0009  * \file   atomic/detail/classify.hpp
0010  *
0011  * This header contains type traits for type classification.
0012  */
0013 
0014 #ifndef BOOST_ATOMIC_DETAIL_CLASSIFY_HPP_INCLUDED_
0015 #define BOOST_ATOMIC_DETAIL_CLASSIFY_HPP_INCLUDED_
0016 
0017 #include <boost/atomic/detail/config.hpp>
0018 #include <boost/atomic/detail/type_traits/is_enum.hpp>
0019 #include <boost/atomic/detail/type_traits/is_integral.hpp>
0020 #include <boost/atomic/detail/type_traits/is_function.hpp>
0021 #include <boost/atomic/detail/type_traits/is_floating_point.hpp>
0022 #include <boost/atomic/detail/header.hpp>
0023 
0024 #ifdef BOOST_HAS_PRAGMA_ONCE
0025 #pragma once
0026 #endif
0027 
0028 namespace boost {
0029 namespace atomics {
0030 namespace detail {
0031 
0032 template< typename T, bool IsFunction = atomics::detail::is_function< T >::value >
0033 struct classify_pointer
0034 {
0035     typedef void* type;
0036 };
0037 
0038 template< typename T >
0039 struct classify_pointer< T, true >
0040 {
0041     typedef void type;
0042 };
0043 
0044 template<
0045     typename T,
0046     bool IsInt = atomics::detail::is_integral< T >::value,
0047     bool IsFloat = atomics::detail::is_floating_point< T >::value,
0048     bool IsEnum = atomics::detail::is_enum< T >::value
0049 >
0050 struct classify
0051 {
0052     typedef void type;
0053 };
0054 
0055 template< typename T >
0056 struct classify< T, true, false, false > { typedef int type; };
0057 
0058 #if !defined(BOOST_ATOMIC_NO_FLOATING_POINT)
0059 template< typename T >
0060 struct classify< T, false, true, false > { typedef float type; };
0061 #endif
0062 
0063 template< typename T >
0064 struct classify< T, false, false, true > { typedef const int type; };
0065 
0066 template< typename T >
0067 struct classify< T*, false, false, false > { typedef typename classify_pointer< T >::type type; };
0068 
0069 template< >
0070 struct classify< void*, false, false, false > { typedef void type; };
0071 
0072 template< >
0073 struct classify< const void*, false, false, false > { typedef void type; };
0074 
0075 template< >
0076 struct classify< volatile void*, false, false, false > { typedef void type; };
0077 
0078 template< >
0079 struct classify< const volatile void*, false, false, false > { typedef void type; };
0080 
0081 template< typename T, typename U >
0082 struct classify< T U::*, false, false, false > { typedef void type; };
0083 
0084 } // namespace detail
0085 } // namespace atomics
0086 } // namespace boost
0087 
0088 #include <boost/atomic/detail/footer.hpp>
0089 
0090 #endif // BOOST_ATOMIC_DETAIL_CLASSIFY_HPP_INCLUDED_