Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-19 08:44:21

0001 /*
0002  * Distributed under the Boost Software License, Version 1.0.
0003  * (See accompanying file LICENSE_1_0.txt or copy at
0004  * https://www.boost.org/LICENSE_1_0.txt)
0005  *
0006  * Copyright (c) 2023 Andrey Semashev
0007  */
0008 /*!
0009  * \file scope/detail/is_nonnull_default_constructible.hpp
0010  *
0011  * This header contains definition of \c is_nonnull_default_constructible
0012  * and \c is_nothrow_nonnull_default_constructible type traits. The type
0013  * traits are useful for preventing default-construction of pointers to
0014  * functions where a default-constructed function object is expected.
0015  * Without it, default- or value-constructing a pointer to function would
0016  * produce a function object that is not callable.
0017  */
0018 
0019 #ifndef BOOST_SCOPE_DETAIL_IS_NONNULL_DEFAULT_CONSTRUCTIBLE_HPP_INCLUDED_
0020 #define BOOST_SCOPE_DETAIL_IS_NONNULL_DEFAULT_CONSTRUCTIBLE_HPP_INCLUDED_
0021 
0022 #include <type_traits>
0023 #include <boost/scope/detail/config.hpp>
0024 #include <boost/scope/detail/header.hpp>
0025 
0026 #ifdef BOOST_HAS_PRAGMA_ONCE
0027 #pragma once
0028 #endif
0029 
0030 namespace boost {
0031 namespace scope {
0032 namespace detail {
0033 
0034 //! The type trait checks if \c T is not a pointer and is default-constructible
0035 template< typename T >
0036 struct is_nonnull_default_constructible :
0037     public std::is_default_constructible< T >
0038 {
0039 };
0040 
0041 template< typename T >
0042 struct is_nonnull_default_constructible< T* > :
0043     public std::false_type
0044 {
0045 };
0046 
0047 //! The type trait checks if \c T is not a pointer and is nothrow-default-constructible
0048 template< typename T >
0049 struct is_nothrow_nonnull_default_constructible :
0050     public std::is_nothrow_default_constructible< T >
0051 {
0052 };
0053 
0054 template< typename T >
0055 struct is_nothrow_nonnull_default_constructible< T* > :
0056     public std::false_type
0057 {
0058 };
0059 
0060 } // namespace detail
0061 } // namespace scope
0062 } // namespace boost
0063 
0064 #include <boost/scope/detail/footer.hpp>
0065 
0066 #endif // BOOST_SCOPE_DETAIL_IS_NONNULL_DEFAULT_CONSTRUCTIBLE_HPP_INCLUDED_