1 /////////////////////////////////////////////////////////////////////////////
3 // (C) Copyright Ion Gaztanaga 2014-2014
5 // Distributed under the Boost Software License, Version 1.0.
6 // (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 // See http://www.boost.org/libs/intrusive for documentation.
11 /////////////////////////////////////////////////////////////////////////////
13 #ifndef BOOST_INTRUSIVE_DETAIL_ARRAY_INITIALIZER_HPP
14 #define BOOST_INTRUSIVE_DETAIL_ARRAY_INITIALIZER_HPP
16 #ifndef BOOST_CONFIG_HPP
17 # include <boost/config.hpp>
20 #if defined(BOOST_HAS_PRAGMA_ONCE)
24 #include <boost/config.hpp>
25 #include <boost/core/no_exceptions_support.hpp>
31 //This is not standard, but should work with all compilers
38 #ifdef BOOST_HAS_LONG_LONG
39 ::boost::long_long_type long_long_;
43 long double long_double_;
47 template<class T, std::size_t N>
48 class array_initializer
51 template<class CommonInitializer>
52 array_initializer(const CommonInitializer &init)
54 char *init_buf = (char*)rawbuf;
59 init_buf += sizeof(T);
64 init_buf -= sizeof(T);
73 { return (T*)(rawbuf); }
75 operator const T*() const
76 { return (const T*)(rawbuf); }
80 char *init_buf = (char*)rawbuf + N*sizeof(T);
81 for(std::size_t i = 0; i != N; ++i){
82 init_buf -= sizeof(T);
88 detail::max_align rawbuf[(N*sizeof(T)-1)/sizeof(detail::max_align)+1];
92 } //namespace intrusive{
95 #endif //BOOST_INTRUSIVE_DETAIL_ARRAY_INITIALIZER_HPP