Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:30:29

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 #if defined(__has_builtin)
0015 # if __has_builtin(__builtin_launder)
0016 #  define BOOST_CORE_HAS_BUILTIN_LAUNDER
0017 # endif
0018 #endif
0019 
0020 #if (__cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)) && !defined(BOOST_CORE_HAS_BUILTIN_LAUNDER)
0021 # include <new>
0022 #endif
0023 
0024 namespace boost
0025 {
0026 namespace core
0027 {
0028 
0029 #if defined(BOOST_CORE_HAS_BUILTIN_LAUNDER)
0030 
0031 template<class T> T* launder( T* p )
0032 {
0033     return __builtin_launder( p );
0034 }
0035 
0036 #elif (__cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)) && defined(__cpp_lib_launder)
0037 
0038 template<class T> T* launder( T* p )
0039 {
0040     return std::launder( p );
0041 }
0042 
0043 #else
0044 
0045 template<class T> T* launder( T* p )
0046 {
0047     return p;
0048 }
0049 
0050 #endif
0051 
0052 } // namespace core
0053 } // namespace boost
0054 
0055 #endif  // #ifndef BOOST_CORE_LAUNDER_HPP_INCLUDED