Add Activ libs & includes
This commit is contained in:
1 parent
f72e9053b0
commit
28ed30c944
10967 files changed
+2306716
No files matched your search
@@ -0,0 +1,71 @@
|
||||
// Copyright (C) 2003, 2008 Fernando Luis Cacciola Carballal.
|
||||
// Copyright (C) 2016 Andrzej Krzemienski.
|
||||
//
|
||||
// Use, modification, and distribution is subject to 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/optional for documentation.
|
||||
//
|
||||
// You are welcome to contact the author at:
|
||||
// fernando_cacciola@hotmail.com
|
||||
// akrzemi1@gmail.com
|
||||
|
||||
#ifndef ACTIV_BOOST_OPTIONAL_OPTIONAL_DETAIL_OPTIONAL_ALIGNED_STORAGE_AJK_12FEB2016_HPP
|
||||
#define ACTIV_BOOST_OPTIONAL_OPTIONAL_DETAIL_OPTIONAL_ALIGNED_STORAGE_AJK_12FEB2016_HPP
|
||||
|
||||
namespace Boost {
|
||||
|
||||
namespace optional_detail {
|
||||
// This local class is used instead of that in "aligned_storage.hpp"
|
||||
// because I've found the 'official' class to ICE BCB5.5
|
||||
// when some types are used with optional<>
|
||||
// (due to sizeof() passed down as a non-type template parameter)
|
||||
template <class T>
|
||||
class aligned_storage
|
||||
{
|
||||
// Borland ICEs if unnamed unions are used for this!
|
||||
// ACTIV_BOOST_MAY_ALIAS works around GCC warnings about breaking strict aliasing rules when casting storage address to T*
|
||||
union ACTIV_BOOST_MAY_ALIAS dummy_u
|
||||
{
|
||||
unsigned char data[ sizeof(T) ];
|
||||
ACTIV_BOOST_DEDUCED_TYPENAME type_with_alignment<
|
||||
::Boost::alignment_of<T>::value >::type aligner_;
|
||||
} dummy_ ;
|
||||
|
||||
public:
|
||||
|
||||
#if defined(ACTIV_BOOST_OPTIONAL_DETAIL_USE_ATTRIBUTE_MAY_ALIAS)
|
||||
void const* address() const { return &dummy_; }
|
||||
void * address() { return &dummy_; }
|
||||
#else
|
||||
void const* address() const { return dummy_.data; }
|
||||
void * address() { return dummy_.data; }
|
||||
#endif
|
||||
|
||||
#if defined(ACTIV_BOOST_OPTIONAL_DETAIL_USE_ATTRIBUTE_MAY_ALIAS)
|
||||
// This workaround is supposed to silence GCC warnings about broken strict aliasing rules
|
||||
T const* ptr_ref() const
|
||||
{
|
||||
union { void const* ap_pvoid; T const* as_ptype; } caster = { address() };
|
||||
return caster.as_ptype;
|
||||
}
|
||||
T * ptr_ref()
|
||||
{
|
||||
union { void* ap_pvoid; T* as_ptype; } caster = { address() };
|
||||
return caster.as_ptype;
|
||||
}
|
||||
#else
|
||||
T const* ptr_ref() const { return static_cast<T const*>(address()); }
|
||||
T * ptr_ref() { return static_cast<T *> (address()); }
|
||||
#endif
|
||||
|
||||
T const& ref() const { return *ptr_ref(); }
|
||||
T & ref() { return *ptr_ref(); }
|
||||
|
||||
} ;
|
||||
|
||||
} // namespace optional_detail
|
||||
} // namespace Boost
|
||||
|
||||
#endif // header guard
|
||||
Reference in new issue
Block a user