Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/boost/core/launder.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 #ifndef BOOST_CORE_LAUNDER_HPP_INCLUDED
0002 #define BOOST_CORE_LAUNDER_HPP_INCLUDED
0003 
0004 // MS compatible compilers support #pragma once
0005 
0006 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
0007 # pragma once
0008 #endif
0009 
0010 //  Copyright 2023 Peter Dimov
0011 //  Distributed under the Boost Software License, Version 1.0.
0012 //  https://www.boost.org/LICENSE_1_0.txt
0013 
0014 #include <boost/config.hpp>
0015 
0016 #if defined(__has_builtin)
0017 # if __has_builtin(__builtin_launder)
0018 #  define BOOST_CORE_HAS_BUILTIN_LAUNDER
0019 # endif
0020 #endif
0021 
0022 #if defined(BOOST_MSVC) && BOOST_MSVC < 1920
0023 
0024 // msvc-14.1 suffers from internal compiler errors when using std::launder
0025 // https://github.com/boostorg/core/issues/160
0026 // https://github.com/boostorg/optional/issues/122
0027 
0028 #elif (BOOST_CXX_VERSION >= 201703L) && !defined(BOOST_CORE_HAS_BUILTIN_LAUNDER)
0029 
0030 #include <new>
0031 
0032 #if defined(__cpp_lib_launder)
0033 # define BOOST_CORE_HAS_STD_LAUNDER
0034 #endif
0035 
0036 #endif
0037 
0038 namespace boost
0039 {
0040 namespace core
0041 {
0042 
0043 #if defined(BOOST_CORE_HAS_BUILTIN_LAUNDER)
0044 
0045 template<class T> T* launder( T* p )
0046 {
0047     return __builtin_launder( p );
0048 }
0049 
0050 #elif defined(BOOST_CORE_HAS_STD_LAUNDER)
0051 
0052 template<class T> T* launder( T* p )
0053 {
0054     return std::launder( p );
0055 }
0056 
0057 #else
0058 
0059 template<class T> T* launder( T* p )
0060 {
0061     return p;
0062 }
0063 
0064 #endif
0065 
0066 } // namespace core
0067 } // namespace boost
0068 
0069 #endif  // #ifndef BOOST_CORE_LAUNDER_HPP_INCLUDED