1/* Copyright 2016-2017 Joaquin M Lopez Munoz.
2 * Distributed under the Boost Software License, Version 1.0.
3 * (See accompanying file LICENSE_1_0.txt or copy at
4 * http://www.boost.org/LICENSE_1_0.txt)
5 *
6 * See http://www.boost.org/libs/poly_collection for library home page.
7 */
8
9#ifndef BOOST_POLY_COLLECTION_DETAIL_IS_FINAL_HPP
10#define BOOST_POLY_COLLECTION_DETAIL_IS_FINAL_HPP
11
12#if defined(_MSC_VER)
13#pragma once
14#endif
15
16#include <boost/type_traits/is_final.hpp>
17#include <type_traits>
18
19/* technique explained at
20 * http://bannalia.blogspot.com/2016/09/compile-time-checking-existence-of.html
21 */
22
23namespace boost{
24namespace poly_collection{
25namespace detail{
26namespace is_final_fallback{
27
28template<typename T> using is_final=boost::is_final<T>;
29
30struct hook{};
31
32}}}}
33
34namespace std{
35
36template<>
37struct is_void< ::boost::poly_collection::detail::is_final_fallback::hook>:
38 std::false_type
39{
40 template<typename T>
41 static constexpr bool is_final_f()
42 {
43 using namespace ::boost::poly_collection::detail::is_final_fallback;
44 return is_final<T>::value;
45 }
46};
47
48} /* namespace std */
49
50namespace boost{
51
52namespace poly_collection{
53
54namespace detail{
55
56template<typename T>
57struct is_final:std::integral_constant<
58 bool,
59 std::is_void<is_final_fallback::hook>::template is_final_f<T>()
60>{};
61
62} /* namespace poly_collection::detail */
63
64} /* namespace poly_collection */
65
66} /* namespace boost */
67
68#endif
69

source code of boost/libs/poly_collection/include/boost/poly_collection/detail/is_final.hpp