整理
This commit is contained in:
44
include/boost/align/detail/add_reference.hpp
Normal file
44
include/boost/align/detail/add_reference.hpp
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
Copyright 2019 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ADD_REFERENCE_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ADD_REFERENCE_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)
|
||||
#include <type_traits>
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
namespace detail {
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)
|
||||
using std::add_lvalue_reference;
|
||||
#else
|
||||
template<class T>
|
||||
struct add_lvalue_reference {
|
||||
typedef T& type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct add_lvalue_reference<void> {
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct add_lvalue_reference<const void> {
|
||||
typedef const void type;
|
||||
};
|
||||
#endif
|
||||
|
||||
} /* detail */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
38
include/boost/align/detail/align.hpp
Normal file
38
include/boost/align/detail/align.hpp
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
Copyright 2014-2020 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ALIGN_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ALIGN_HPP
|
||||
|
||||
#include <boost/align/detail/is_alignment.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
|
||||
inline void*
|
||||
align(std::size_t alignment, std::size_t size, void*& ptr,
|
||||
std::size_t& space)
|
||||
{
|
||||
BOOST_ASSERT(boost::alignment::detail::is_alignment(alignment));
|
||||
if (size <= space) {
|
||||
char* p = reinterpret_cast<char*>(~(alignment - 1) &
|
||||
(reinterpret_cast<std::size_t>(ptr) + alignment - 1));
|
||||
std::size_t n = p - static_cast<char*>(ptr);
|
||||
if (n <= space - size) {
|
||||
ptr = p;
|
||||
space -= n;
|
||||
return p;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
21
include/boost/align/detail/align_cxx11.hpp
Normal file
21
include/boost/align/detail/align_cxx11.hpp
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
Copyright 2014 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ALIGN_CXX11_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ALIGN_CXX11_HPP
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
|
||||
using std::align;
|
||||
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
28
include/boost/align/detail/align_down.hpp
Normal file
28
include/boost/align/detail/align_down.hpp
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
Copyright 2015 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ALIGN_DOWN_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ALIGN_DOWN_HPP
|
||||
|
||||
#include <boost/align/detail/is_alignment.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
|
||||
inline void*
|
||||
align_down(void* ptr, std::size_t alignment) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(detail::is_alignment(alignment));
|
||||
return reinterpret_cast<void*>(~(alignment - 1) &
|
||||
reinterpret_cast<std::size_t>(ptr));
|
||||
}
|
||||
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
28
include/boost/align/detail/align_up.hpp
Normal file
28
include/boost/align/detail/align_up.hpp
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
Copyright 2015 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ALIGN_UP_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ALIGN_UP_HPP
|
||||
|
||||
#include <boost/align/detail/is_alignment.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
|
||||
inline void*
|
||||
align_up(void* ptr, std::size_t alignment) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(detail::is_alignment(alignment));
|
||||
return reinterpret_cast<void*>(~(alignment - 1) &
|
||||
(reinterpret_cast<std::size_t>(ptr) + alignment - 1));
|
||||
}
|
||||
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
52
include/boost/align/detail/aligned_alloc.hpp
Normal file
52
include/boost/align/detail/aligned_alloc.hpp
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
Copyright 2014-2015 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_HPP
|
||||
|
||||
#include <boost/align/detail/is_alignment.hpp>
|
||||
#include <boost/align/align.hpp>
|
||||
#include <boost/align/alignment_of.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <cstdlib>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
|
||||
inline void*
|
||||
aligned_alloc(std::size_t alignment, std::size_t size) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(detail::is_alignment(alignment));
|
||||
enum {
|
||||
N = alignment_of<void*>::value
|
||||
};
|
||||
if (alignment < N) {
|
||||
alignment = N;
|
||||
}
|
||||
std::size_t n = size + alignment - N;
|
||||
void* p = std::malloc(sizeof(void*) + n);
|
||||
if (p) {
|
||||
void* r = static_cast<char*>(p) + sizeof(void*);
|
||||
(void)boost::alignment::align(alignment, size, r, n);
|
||||
*(static_cast<void**>(r) - 1) = p;
|
||||
p = r;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
inline void
|
||||
aligned_free(void* ptr) BOOST_NOEXCEPT
|
||||
{
|
||||
if (ptr) {
|
||||
std::free(*(static_cast<void**>(ptr) - 1));
|
||||
}
|
||||
}
|
||||
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
34
include/boost/align/detail/aligned_alloc_android.hpp
Normal file
34
include/boost/align/detail/aligned_alloc_android.hpp
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
Copyright 2014 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_ANDROID_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_ANDROID_HPP
|
||||
|
||||
#include <boost/align/detail/is_alignment.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <malloc.h>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
|
||||
inline void*
|
||||
aligned_alloc(std::size_t alignment, std::size_t size) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(detail::is_alignment(alignment));
|
||||
return ::memalign(alignment, size);
|
||||
}
|
||||
|
||||
inline void
|
||||
aligned_free(void* ptr) BOOST_NOEXCEPT
|
||||
{
|
||||
::free(ptr);
|
||||
}
|
||||
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
44
include/boost/align/detail/aligned_alloc_macos.hpp
Normal file
44
include/boost/align/detail/aligned_alloc_macos.hpp
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
Copyright 2014 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_MACOS_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_MACOS_HPP
|
||||
|
||||
#include <boost/align/detail/is_alignment.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
|
||||
inline void*
|
||||
aligned_alloc(std::size_t alignment, std::size_t size) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(detail::is_alignment(alignment));
|
||||
if (size == 0) {
|
||||
return 0;
|
||||
}
|
||||
if (alignment < sizeof(void*)) {
|
||||
alignment = sizeof(void*);
|
||||
}
|
||||
void* p;
|
||||
if (::posix_memalign(&p, alignment, size) != 0) {
|
||||
p = 0;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
inline void
|
||||
aligned_free(void* ptr) BOOST_NOEXCEPT
|
||||
{
|
||||
::free(ptr);
|
||||
}
|
||||
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
34
include/boost/align/detail/aligned_alloc_mingw.hpp
Normal file
34
include/boost/align/detail/aligned_alloc_mingw.hpp
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
Copyright 2020 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_MINGW_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_MINGW_HPP
|
||||
|
||||
#include <boost/align/detail/is_alignment.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <malloc.h>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
|
||||
inline void*
|
||||
aligned_alloc(std::size_t alignment, std::size_t size) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(detail::is_alignment(alignment));
|
||||
return ::__mingw_aligned_malloc(size, alignment);
|
||||
}
|
||||
|
||||
inline void
|
||||
aligned_free(void* ptr) BOOST_NOEXCEPT
|
||||
{
|
||||
::__mingw_aligned_free(ptr);
|
||||
}
|
||||
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
34
include/boost/align/detail/aligned_alloc_msvc.hpp
Normal file
34
include/boost/align/detail/aligned_alloc_msvc.hpp
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
Copyright 2014 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_MSVC_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_MSVC_HPP
|
||||
|
||||
#include <boost/align/detail/is_alignment.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <malloc.h>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
|
||||
inline void*
|
||||
aligned_alloc(std::size_t alignment, std::size_t size) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(detail::is_alignment(alignment));
|
||||
return ::_aligned_malloc(size, alignment);
|
||||
}
|
||||
|
||||
inline void
|
||||
aligned_free(void* ptr) BOOST_NOEXCEPT
|
||||
{
|
||||
::_aligned_free(ptr);
|
||||
}
|
||||
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
52
include/boost/align/detail/aligned_alloc_new.hpp
Normal file
52
include/boost/align/detail/aligned_alloc_new.hpp
Normal file
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
Copyright 2014-2015 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_NEW_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_NEW_HPP
|
||||
|
||||
#include <boost/align/detail/is_alignment.hpp>
|
||||
#include <boost/align/align.hpp>
|
||||
#include <boost/align/alignment_of.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <new>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
|
||||
inline void*
|
||||
aligned_alloc(std::size_t alignment, std::size_t size) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(detail::is_alignment(alignment));
|
||||
enum {
|
||||
N = alignment_of<void*>::value
|
||||
};
|
||||
if (alignment < N) {
|
||||
alignment = N;
|
||||
}
|
||||
std::size_t n = size + alignment - N;
|
||||
void* p = ::operator new(sizeof(void*) + n, std::nothrow);
|
||||
if (p) {
|
||||
void* r = static_cast<char*>(p) + sizeof(void*);
|
||||
(void)boost::alignment::align(alignment, size, r, n);
|
||||
*(static_cast<void**>(r) - 1) = p;
|
||||
p = r;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
inline void
|
||||
aligned_free(void* ptr) BOOST_NOEXCEPT
|
||||
{
|
||||
if (ptr) {
|
||||
::operator delete(*(static_cast<void**>(ptr) - 1));
|
||||
}
|
||||
}
|
||||
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
41
include/boost/align/detail/aligned_alloc_posix.hpp
Normal file
41
include/boost/align/detail/aligned_alloc_posix.hpp
Normal file
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
Copyright 2014 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_POSIX_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_POSIX_HPP
|
||||
|
||||
#include <boost/align/detail/is_alignment.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
|
||||
inline void*
|
||||
aligned_alloc(std::size_t alignment, std::size_t size) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(detail::is_alignment(alignment));
|
||||
if (alignment < sizeof(void*)) {
|
||||
alignment = sizeof(void*);
|
||||
}
|
||||
void* p;
|
||||
if (::posix_memalign(&p, alignment, size) != 0) {
|
||||
p = 0;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
inline void
|
||||
aligned_free(void* ptr) BOOST_NOEXCEPT
|
||||
{
|
||||
::free(ptr);
|
||||
}
|
||||
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
34
include/boost/align/detail/aligned_alloc_sunos.hpp
Normal file
34
include/boost/align/detail/aligned_alloc_sunos.hpp
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
Copyright 2014 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_SUNOS_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ALIGNED_ALLOC_SUNOS_HPP
|
||||
|
||||
#include <boost/align/detail/is_alignment.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
|
||||
inline void*
|
||||
aligned_alloc(std::size_t alignment, std::size_t size) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(detail::is_alignment(alignment));
|
||||
return ::memalign(alignment, size);
|
||||
}
|
||||
|
||||
inline void
|
||||
aligned_free(void* ptr) BOOST_NOEXCEPT
|
||||
{
|
||||
::free(ptr);
|
||||
}
|
||||
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
31
include/boost/align/detail/alignment_of.hpp
Normal file
31
include/boost/align/detail/alignment_of.hpp
Normal file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
Copyright 2014-2015 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ALIGNMENT_OF_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ALIGNMENT_OF_HPP
|
||||
|
||||
#include <boost/align/detail/min_size.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
namespace detail {
|
||||
|
||||
template<class T>
|
||||
struct offset_value {
|
||||
char value;
|
||||
T object;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct alignment_of
|
||||
: min_size<sizeof(T), sizeof(offset_value<T>) - sizeof(T)> { };
|
||||
|
||||
} /* detail */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
26
include/boost/align/detail/alignment_of_clang.hpp
Normal file
26
include/boost/align/detail/alignment_of_clang.hpp
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
Copyright 2014 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ALIGNMENT_OF_CLANG_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ALIGNMENT_OF_CLANG_HPP
|
||||
|
||||
#include <boost/align/detail/integral_constant.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
namespace detail {
|
||||
|
||||
template<class T>
|
||||
struct alignment_of
|
||||
: integral_constant<std::size_t, __alignof(T)> { };
|
||||
|
||||
} /* detail */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
26
include/boost/align/detail/alignment_of_codegear.hpp
Normal file
26
include/boost/align/detail/alignment_of_codegear.hpp
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
Copyright 2014 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ALIGNMENT_OF_CODEGEAR_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ALIGNMENT_OF_CODEGEAR_HPP
|
||||
|
||||
#include <boost/align/detail/integral_constant.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
namespace detail {
|
||||
|
||||
template<class T>
|
||||
struct alignment_of
|
||||
: integral_constant<std::size_t, alignof(T)> { };
|
||||
|
||||
} /* detail */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
23
include/boost/align/detail/alignment_of_cxx11.hpp
Normal file
23
include/boost/align/detail/alignment_of_cxx11.hpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright 2014 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ALIGNMENT_OF_CXX11_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ALIGNMENT_OF_CXX11_HPP
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
namespace detail {
|
||||
|
||||
using std::alignment_of;
|
||||
|
||||
} /* detail */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
26
include/boost/align/detail/alignment_of_gcc.hpp
Normal file
26
include/boost/align/detail/alignment_of_gcc.hpp
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
Copyright 2014 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ALIGNMENT_OF_GCC_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ALIGNMENT_OF_GCC_HPP
|
||||
|
||||
#include <boost/align/detail/integral_constant.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
namespace detail {
|
||||
|
||||
template<class T>
|
||||
struct alignment_of
|
||||
: integral_constant<std::size_t, __alignof__(T)> { };
|
||||
|
||||
} /* detail */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
32
include/boost/align/detail/alignment_of_msvc.hpp
Normal file
32
include/boost/align/detail/alignment_of_msvc.hpp
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
Copyright 2014-2015 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ALIGNMENT_OF_MSVC_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ALIGNMENT_OF_MSVC_HPP
|
||||
|
||||
#include <boost/align/detail/min_size.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
namespace detail {
|
||||
|
||||
template<class T>
|
||||
struct offset_value {
|
||||
T first;
|
||||
char value;
|
||||
T second;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct alignment_of
|
||||
: min_size<sizeof(T), sizeof(offset_value<T>) - (sizeof(T) << 1)> { };
|
||||
|
||||
} /* detail */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
16
include/boost/align/detail/assume_aligned.hpp
Normal file
16
include/boost/align/detail/assume_aligned.hpp
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
Copyright 2015 NumScale SAS
|
||||
Copyright 2015 LRI UMR 8623 CNRS/University Paris Sud XI
|
||||
|
||||
Copyright 2015 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_HPP
|
||||
|
||||
#define BOOST_ALIGN_ASSUME_ALIGNED(ptr, alignment)
|
||||
|
||||
#endif
|
||||
18
include/boost/align/detail/assume_aligned_clang.hpp
Normal file
18
include/boost/align/detail/assume_aligned_clang.hpp
Normal file
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
Copyright 2015 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_CLANG_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_CLANG_HPP
|
||||
|
||||
#if __has_builtin(__builtin_assume_aligned)
|
||||
#define BOOST_ALIGN_ASSUME_ALIGNED(p, n) \
|
||||
(p) = static_cast<__typeof__(p)>(__builtin_assume_aligned((p), (n)))
|
||||
#else
|
||||
#define BOOST_ALIGN_ASSUME_ALIGNED(p, n)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
17
include/boost/align/detail/assume_aligned_gcc.hpp
Normal file
17
include/boost/align/detail/assume_aligned_gcc.hpp
Normal file
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
Copyright 2015 NumScale SAS
|
||||
Copyright 2015 LRI UMR 8623 CNRS/University Paris Sud XI
|
||||
|
||||
Copyright 2015 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_GCC_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_GCC_HPP
|
||||
|
||||
#define BOOST_ALIGN_ASSUME_ALIGNED(p, n) \
|
||||
(p) = static_cast<__typeof__(p)>(__builtin_assume_aligned((p), (n)))
|
||||
|
||||
#endif
|
||||
17
include/boost/align/detail/assume_aligned_intel.hpp
Normal file
17
include/boost/align/detail/assume_aligned_intel.hpp
Normal file
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
Copyright 2015 NumScale SAS
|
||||
Copyright 2015 LRI UMR 8623 CNRS/University Paris Sud XI
|
||||
|
||||
Copyright 2015 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_INTEL_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_INTEL_HPP
|
||||
|
||||
#define BOOST_ALIGN_ASSUME_ALIGNED(ptr, alignment) \
|
||||
__assume_aligned((ptr), (alignment))
|
||||
|
||||
#endif
|
||||
19
include/boost/align/detail/assume_aligned_msvc.hpp
Normal file
19
include/boost/align/detail/assume_aligned_msvc.hpp
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
Copyright 2015 NumScale SAS
|
||||
Copyright 2015 LRI UMR 8623 CNRS/University Paris Sud XI
|
||||
|
||||
Copyright 2015 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_MSVC_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ASSUME_ALIGNED_MSVC_HPP
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#define BOOST_ALIGN_ASSUME_ALIGNED(ptr, alignment) \
|
||||
__assume((reinterpret_cast<std::size_t>(ptr) & ((alignment) - 1)) == 0)
|
||||
|
||||
#endif
|
||||
91
include/boost/align/detail/element_type.hpp
Normal file
91
include/boost/align/detail/element_type.hpp
Normal file
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
Copyright 2015 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_ELEMENT_TYPE_HPP
|
||||
#define BOOST_ALIGN_DETAIL_ELEMENT_TYPE_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)
|
||||
#include <type_traits>
|
||||
#else
|
||||
#include <cstddef>
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
namespace detail {
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)
|
||||
using std::remove_reference;
|
||||
using std::remove_all_extents;
|
||||
using std::remove_cv;
|
||||
#else
|
||||
template<class T>
|
||||
struct remove_reference {
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct remove_reference<T&> {
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
|
||||
template<class T>
|
||||
struct remove_reference<T&&> {
|
||||
typedef T type;
|
||||
};
|
||||
#endif
|
||||
|
||||
template<class T>
|
||||
struct remove_all_extents {
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct remove_all_extents<T[]> {
|
||||
typedef typename remove_all_extents<T>::type type;
|
||||
};
|
||||
|
||||
template<class T, std::size_t N>
|
||||
struct remove_all_extents<T[N]> {
|
||||
typedef typename remove_all_extents<T>::type type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct remove_cv {
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct remove_cv<const T> {
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct remove_cv<volatile T> {
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct remove_cv<const volatile T> {
|
||||
typedef T type;
|
||||
};
|
||||
#endif
|
||||
|
||||
template<class T>
|
||||
struct element_type {
|
||||
typedef typename remove_cv<typename remove_all_extents<typename
|
||||
remove_reference<T>::type>::type>::type type;
|
||||
};
|
||||
|
||||
} /* detail */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
53
include/boost/align/detail/integral_constant.hpp
Normal file
53
include/boost/align/detail/integral_constant.hpp
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
Copyright 2014-2016 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_INTEGRAL_CONSTANT_HPP
|
||||
#define BOOST_ALIGN_DETAIL_INTEGRAL_CONSTANT_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)
|
||||
#include <type_traits>
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
namespace detail {
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)
|
||||
using std::integral_constant;
|
||||
using std::true_type;
|
||||
using std::false_type;
|
||||
#else
|
||||
template<class T, T Value>
|
||||
struct integral_constant {
|
||||
typedef T value_type;
|
||||
typedef integral_constant type;
|
||||
|
||||
BOOST_CONSTEXPR operator value_type() const BOOST_NOEXCEPT {
|
||||
return Value;
|
||||
}
|
||||
|
||||
BOOST_CONSTEXPR value_type operator()() const BOOST_NOEXCEPT {
|
||||
return Value;
|
||||
}
|
||||
|
||||
BOOST_STATIC_CONSTEXPR T value = Value;
|
||||
};
|
||||
|
||||
template<class T, T Value>
|
||||
BOOST_CONSTEXPR_OR_CONST T integral_constant<T, Value>::value;
|
||||
|
||||
typedef integral_constant<bool, true> true_type;
|
||||
typedef integral_constant<bool, false> false_type;
|
||||
#endif
|
||||
|
||||
} /* detail */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
34
include/boost/align/detail/is_aligned.hpp
Normal file
34
include/boost/align/detail/is_aligned.hpp
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
Copyright 2014 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_IS_ALIGNED_HPP
|
||||
#define BOOST_ALIGN_DETAIL_IS_ALIGNED_HPP
|
||||
|
||||
#include <boost/align/detail/is_alignment.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
|
||||
inline bool
|
||||
is_aligned(const volatile void* ptr, std::size_t alignment) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(detail::is_alignment(alignment));
|
||||
return (reinterpret_cast<std::size_t>(ptr) & (alignment - 1)) == 0;
|
||||
}
|
||||
|
||||
inline bool
|
||||
is_aligned(std::size_t alignment, const volatile void* ptr) BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_ASSERT(detail::is_alignment(alignment));
|
||||
return (reinterpret_cast<std::size_t>(ptr) & (alignment - 1)) == 0;
|
||||
}
|
||||
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
28
include/boost/align/detail/is_alignment.hpp
Normal file
28
include/boost/align/detail/is_alignment.hpp
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
Copyright 2014 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_IS_ALIGNMENT_HPP
|
||||
#define BOOST_ALIGN_DETAIL_IS_ALIGNMENT_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
namespace detail {
|
||||
|
||||
BOOST_CONSTEXPR inline bool
|
||||
is_alignment(std::size_t value) BOOST_NOEXCEPT
|
||||
{
|
||||
return (value > 0) && ((value & (value - 1)) == 0);
|
||||
}
|
||||
|
||||
} /* detail */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
26
include/boost/align/detail/is_alignment_constant.hpp
Normal file
26
include/boost/align/detail/is_alignment_constant.hpp
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
Copyright 2014 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_IS_ALIGNMENT_CONSTANT_HPP
|
||||
#define BOOST_ALIGN_DETAIL_IS_ALIGNMENT_CONSTANT_HPP
|
||||
|
||||
#include <boost/align/detail/integral_constant.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
namespace detail {
|
||||
|
||||
template<std::size_t N>
|
||||
struct is_alignment_constant
|
||||
: integral_constant<bool, (N > 0) && ((N & (N - 1)) == 0)> { };
|
||||
|
||||
} /* detail */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
26
include/boost/align/detail/max_align.hpp
Normal file
26
include/boost/align/detail/max_align.hpp
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
Copyright 2014-2015 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_MAX_ALIGN_HPP
|
||||
#define BOOST_ALIGN_DETAIL_MAX_ALIGN_HPP
|
||||
|
||||
#include <boost/align/detail/max_size.hpp>
|
||||
#include <boost/align/alignment_of.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
namespace detail {
|
||||
|
||||
template<class A, class B>
|
||||
struct max_align
|
||||
: max_size<alignment_of<A>::value, alignment_of<B>::value> { };
|
||||
|
||||
} /* detail */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
27
include/boost/align/detail/max_objects.hpp
Normal file
27
include/boost/align/detail/max_objects.hpp
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
Copyright 2014 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_MAX_OBJECTS_HPP
|
||||
#define BOOST_ALIGN_DETAIL_MAX_OBJECTS_HPP
|
||||
|
||||
#include <boost/align/detail/integral_constant.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
namespace detail {
|
||||
|
||||
template<class T>
|
||||
struct max_objects
|
||||
: integral_constant<std::size_t,
|
||||
~static_cast<std::size_t>(0) / sizeof(T)> { };
|
||||
|
||||
} /* detail */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
26
include/boost/align/detail/max_size.hpp
Normal file
26
include/boost/align/detail/max_size.hpp
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
Copyright 2014-2015 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_MAX_SIZE_HPP
|
||||
#define BOOST_ALIGN_DETAIL_MAX_SIZE_HPP
|
||||
|
||||
#include <boost/align/detail/integral_constant.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
namespace detail {
|
||||
|
||||
template<std::size_t A, std::size_t B>
|
||||
struct max_size
|
||||
: integral_constant<std::size_t, (A > B) ? A : B> { };
|
||||
|
||||
} /* detail */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
26
include/boost/align/detail/min_size.hpp
Normal file
26
include/boost/align/detail/min_size.hpp
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
Copyright 2014 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_MIN_SIZE_HPP
|
||||
#define BOOST_ALIGN_DETAIL_MIN_SIZE_HPP
|
||||
|
||||
#include <boost/align/detail/integral_constant.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
namespace detail {
|
||||
|
||||
template<std::size_t A, std::size_t B>
|
||||
struct min_size
|
||||
: integral_constant<std::size_t, (A < B) ? A : B> { };
|
||||
|
||||
} /* detail */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
27
include/boost/align/detail/not_pointer.hpp
Normal file
27
include/boost/align/detail/not_pointer.hpp
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
Copyright 2019 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_NOT_POINTER_HPP
|
||||
#define BOOST_ALIGN_DETAIL_NOT_POINTER_HPP
|
||||
|
||||
namespace boost {
|
||||
namespace alignment {
|
||||
namespace detail {
|
||||
|
||||
template<class T, class U>
|
||||
struct not_pointer {
|
||||
typedef U type;
|
||||
};
|
||||
|
||||
template<class T, class U>
|
||||
struct not_pointer<T*, U> { };
|
||||
|
||||
} /* detail */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
44
include/boost/align/detail/throw_exception.hpp
Normal file
44
include/boost/align/detail/throw_exception.hpp
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
Copyright 2019 Glen Joseph Fernandes
|
||||
(glenjofe@gmail.com)
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef BOOST_ALIGN_DETAIL_THROW_EXCEPTION_HPP
|
||||
#define BOOST_ALIGN_DETAIL_THROW_EXCEPTION_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#if defined(BOOST_NO_EXCEPTIONS)
|
||||
#include <exception>
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
#if defined(BOOST_NO_EXCEPTIONS)
|
||||
BOOST_NORETURN void throw_exception(const std::exception&);
|
||||
#endif
|
||||
|
||||
namespace alignment {
|
||||
namespace detail {
|
||||
|
||||
#if !defined(BOOST_NO_EXCEPTIONS)
|
||||
template<class E>
|
||||
BOOST_NORETURN inline void
|
||||
throw_exception(const E& error)
|
||||
{
|
||||
throw error;
|
||||
}
|
||||
#else
|
||||
BOOST_NORETURN inline void
|
||||
throw_exception(const std::exception& error)
|
||||
{
|
||||
boost::throw_exception(error);
|
||||
}
|
||||
#endif
|
||||
|
||||
} /* detail */
|
||||
} /* alignment */
|
||||
} /* boost */
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user