Add launcer helper

This commit is contained in:
Ion Gaztañaga
2024-04-15 08:56:32 +02:00
parent 08f16be939
commit d6b970285b
2 changed files with 59 additions and 1 deletions

View File

@ -0,0 +1,53 @@
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2014-2015. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/container for documentation.
//
//////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_MOVE_DETAIL_LAUNDER_HPP
#define BOOST_MOVE_DETAIL_LAUNDER_HPP
#ifndef BOOST_CONFIG_HPP
# include <boost/config.hpp>
#endif
#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
#include <boost/move/detail/workaround.hpp>
namespace boost {
namespace move_detail {
#if defined(BOOST_MOVE_HAS_BUILTIN_LAUNDER)
template<class T>
BOOST_MOVE_FORCEINLINE T* launder(T* p)
{
return __builtin_launder( p );
}
#else
template<class T>
BOOST_MOVE_FORCEINLINE T* launder(T* p)
{
return p;
}
#endif
template<class T>
BOOST_MOVE_FORCEINLINE T launder_cast(const volatile void* p)
{
return (launder)((T)p);
}
} //namespace move_detail {
} //namespace boost {
#endif //#ifndef BOOST_MOVE_DETAIL_LAUNDER_HPP

View File

@ -147,5 +147,10 @@ template<unsigned> struct static_assert_test {};
#define BOOST_MOVE_INTRINSIC_CAST BOOST_MOVE_FORCEINLINE
#endif
#endif //#ifndef BOOST_MOVE_DETAIL_WORKAROUND_HPP
#if defined(__has_builtin)
#if __has_builtin(__builtin_launder)
#define BOOST_MOVE_HAS_BUILTIN_LAUNDER
#endif
#endif
#endif //#ifndef BOOST_MOVE_DETAIL_WORKAROUND_HPP