Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:47:49

0001 /* Copyright 2016-2017 Joaquin M Lopez Munoz.
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  * See http://www.boost.org/libs/poly_collection for library home page.
0007  */
0008 
0009 #ifndef BOOST_POLY_COLLECTION_DETAIL_IS_FINAL_HPP
0010 #define BOOST_POLY_COLLECTION_DETAIL_IS_FINAL_HPP
0011 
0012 #if defined(_MSC_VER)
0013 #pragma once
0014 #endif
0015 
0016 #include <boost/type_traits/is_final.hpp>
0017 #include <type_traits>
0018 
0019 /* technique explained at
0020  * http://bannalia.blogspot.com/2016/09/compile-time-checking-existence-of.html 
0021  */
0022 
0023 namespace boost{
0024 namespace poly_collection{
0025 namespace detail{
0026 namespace is_final_fallback{
0027 
0028 template<typename T> using is_final=boost::is_final<T>;
0029 
0030 struct hook{};
0031 
0032 }}}}
0033 
0034 namespace std{
0035 
0036 template<>
0037 struct is_void< ::boost::poly_collection::detail::is_final_fallback::hook>:
0038   std::false_type
0039 {      
0040   template<typename T>
0041   static constexpr bool is_final_f()
0042   {
0043     using namespace ::boost::poly_collection::detail::is_final_fallback;
0044     return is_final<T>::value;
0045   }
0046 };
0047 
0048 } /* namespace std */
0049 
0050 namespace boost{
0051 
0052 namespace poly_collection{
0053 
0054 namespace detail{
0055 
0056 template<typename T>
0057 struct is_final:std::integral_constant<
0058   bool,
0059   std::is_void<is_final_fallback::hook>::template is_final_f<T>()
0060 >{};
0061 
0062 } /* namespace poly_collection::detail */
0063 
0064 } /* namespace poly_collection */
0065 
0066 } /* namespace boost */
0067 
0068 #endif