Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r82627 - in sandbox/varray: boost/container boost/container/detail doc doc/generated example test
From: adam.wulkiewicz_at_[hidden]
Date: 2013-01-26 22:36:13


Author: awulkiew
Date: 2013-01-26 22:36:10 EST (Sat, 26 Jan 2013)
New Revision: 82627
URL: http://svn.boost.org/trac/boost/changeset/82627

Log:
static_vector renamed to varray. Version with Strategy moved to container_detail.
Added:
   sandbox/varray/boost/container/detail/varray.hpp (contents, props changed)
   sandbox/varray/boost/container/detail/varray_concept.hpp
      - copied, changed from r82619, /sandbox/varray/boost/container/detail/static_vector_concept.hpp
   sandbox/varray/boost/container/detail/varray_util.hpp
      - copied, changed from r82619, /sandbox/varray/boost/container/detail/static_vector_util.hpp
   sandbox/varray/boost/container/varray.hpp
      - copied, changed from r82619, /sandbox/varray/boost/container/static_vector.hpp
   sandbox/varray/doc/varray.qbk
      - copied, changed from r82619, /sandbox/varray/doc/static_vector.qbk
   sandbox/varray/example/Jamfile.v2 (contents, props changed)
   sandbox/varray/example/varray_example.cpp
      - copied, changed from r82619, /sandbox/varray/example/static_vector_example.cpp
   sandbox/varray/example/varray_set_example.cpp
      - copied, changed from r82619, /sandbox/varray/example/static_vector_set_example.cpp
   sandbox/varray/test/varray_interprocess_test.cpp
      - copied, changed from r82619, /sandbox/varray/test/static_vector_interprocess_test.cpp
   sandbox/varray/test/varray_test.cpp
      - copied, changed from r82619, /sandbox/varray/test/static_vector_test.cpp
   sandbox/varray/test/varray_test.hpp
      - copied, changed from r82619, /sandbox/varray/test/static_vector_test.hpp
Removed:
   sandbox/varray/boost/container/detail/static_vector_concept.hpp
   sandbox/varray/boost/container/detail/static_vector_util.hpp
   sandbox/varray/boost/container/static_vector.hpp
   sandbox/varray/doc/generated/static_vector.qbk
   sandbox/varray/doc/generated/static_vector_non_member.qbk
   sandbox/varray/doc/generated/strategy_allocator_adaptor.qbk
   sandbox/varray/doc/generated/strategy_def.qbk
   sandbox/varray/doc/static_vector.qbk
   sandbox/varray/example/static_vector_example.cpp
   sandbox/varray/example/static_vector_set_example.cpp
   sandbox/varray/test/static_vector_interprocess_test.cpp
   sandbox/varray/test/static_vector_test.cpp
   sandbox/varray/test/static_vector_test.hpp
Text files modified:
   sandbox/varray/boost/container/detail/varray_concept.hpp | 26
   sandbox/varray/boost/container/detail/varray_util.hpp | 32
   sandbox/varray/boost/container/varray.hpp | 2274 ---------------------------------------
   sandbox/varray/doc/Jamfile.v2 | 8
   sandbox/varray/doc/varray.qbk | 28
   sandbox/varray/example/bench_static_vector.cpp | 12
   sandbox/varray/example/interprocess.cpp | 8
   sandbox/varray/example/times.cpp | 6
   sandbox/varray/example/varray_example.cpp | 16
   sandbox/varray/example/varray_set_example.cpp | 12
   sandbox/varray/test/Jamfile.v2 | 14
   sandbox/varray/test/varray_interprocess_test.cpp | 12
   sandbox/varray/test/varray_test.cpp | 110
   sandbox/varray/test/varray_test.hpp | 14
   14 files changed, 195 insertions(+), 2377 deletions(-)

Deleted: sandbox/varray/boost/container/detail/static_vector_concept.hpp
==============================================================================
--- sandbox/varray/boost/container/detail/static_vector_concept.hpp 2013-01-26 22:36:10 EST (Sat, 26 Jan 2013)
+++ (empty file)
@@ -1,60 +0,0 @@
-// Boost.Container StaticVector
-//
-// Copyright (c) 2012 Andrew Hundt.
-// Copyright (c) 2012 Adam Wulkiewicz, Lodz, Poland.
-//
-// 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)
-
-#ifndef BOOST_CONTAINER_STATIC_VECTOR_CONCEPT_HPP
-#define BOOST_CONTAINER_STATIC_VECTOR_CONCEPT_HPP
-
-#include <boost/concept_check.hpp>
-
-namespace boost { namespace container { namespace concept {
-
-/**
- * StaticVectorStrategyConcept
- *
- * \brief Checks strategy for static_vector<Value,Capacity,Strategy>, which has similarities to std::Allocator
- * \ingroup static_vector
- */
-template<typename Strategy>
-struct StaticVectorStrategy {
-#ifndef DOXYGEN_NO_CONCEPT_MEMBERS
-
- // typedefs are the same as in std::Allocator
- typedef typename Strategy::value_type value_type;
- typedef typename Strategy::size_type size_type;
- typedef typename Strategy::difference_type difference_type;
- typedef typename Strategy::pointer pointer;
- typedef typename Strategy::const_pointer const_pointer;
- typedef typename Strategy::reference reference;
- typedef typename Strategy::const_reference const_reference;
-
- struct check_methods
- {
- static void apply()
- {
- Strategy const* str = 0;
-
- // must implement allocate_failed
- str->allocate_failed();
-
- boost::ignore_unused_variable_warning(str);
- }
- };
-
-public :
- BOOST_CONCEPT_USAGE(StaticVectorStrategy)
- {
- check_methods::apply();
- }
-
-#endif
-};
-
-} /*namespace boost*/ } /*namespace container*/ } /*namespace concept*/
-
-#endif //BOOST_CONTAINER_STATIC_VECTOR_CONCEPT_HPP

Deleted: sandbox/varray/boost/container/detail/static_vector_util.hpp
==============================================================================
--- sandbox/varray/boost/container/detail/static_vector_util.hpp 2013-01-26 22:36:10 EST (Sat, 26 Jan 2013)
+++ (empty file)
@@ -1,786 +0,0 @@
-// Boost.Container
-//
-// StaticVector details
-//
-// Copyright (c) 2012 Adam Wulkiewicz, Lodz, Poland.
-// Copyright (c) 2011-2012 Andrew Hundt.
-//
-// 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)
-
-#ifndef BOOST_CONTAINER_DETAIL_STATIC_VECTOR_UTIL_HPP
-#define BOOST_CONTAINER_DETAIL_STATIC_VECTOR_UTIL_HPP
-
-#include <cstddef>
-#include <cstring>
-#include <memory>
-#include <limits>
-
-#include <boost/mpl/if.hpp>
-#include <boost/mpl/and.hpp>
-#include <boost/mpl/or.hpp>
-#include <boost/mpl/int.hpp>
-
-#include <boost/type_traits/is_same.hpp>
-#include <boost/type_traits/remove_const.hpp>
-#include <boost/type_traits/remove_reference.hpp>
-#include <boost/type_traits/has_trivial_assign.hpp>
-#include <boost/type_traits/has_trivial_copy.hpp>
-#include <boost/type_traits/has_trivial_constructor.hpp>
-#include <boost/type_traits/has_trivial_destructor.hpp>
-//#include <boost/type_traits/has_nothrow_constructor.hpp>
-//#include <boost/type_traits/has_nothrow_copy.hpp>
-//#include <boost/type_traits/has_nothrow_assign.hpp>
-//#include <boost/type_traits/has_nothrow_destructor.hpp>
-
-#include <boost/detail/no_exceptions_support.hpp>
-#include <boost/config.hpp>
-#include <boost/move/move.hpp>
-#include <boost/utility/addressof.hpp>
-#include <boost/iterator/iterator_traits.hpp>
-
-// TODO - move vectors iterators optimization to the other, optional file instead of checking defines?
-
-#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
-
-#if defined(BOOST_CONTAINER_STATIC_VECTOR_ENABLE_VECTORS_OPTIMIZATION) && !defined(BOOST_NO_EXCEPTIONS)
-#include <vector>
-#include <boost/container/vector.hpp>
-#endif // BOOST_CONTAINER_STATIC_VECTOR_ENABLE_ITERATORS_OPTIMIZATION && !BOOST_NO_EXCEPTIONS
-
-namespace boost { namespace container { namespace static_vector_detail {
-
-template <typename I>
-struct are_elements_contiguous : boost::is_pointer<I>
-{};
-
-#if defined(BOOST_CONTAINER_STATIC_VECTOR_ENABLE_VECTORS_OPTIMIZATION) && !defined(BOOST_NO_EXCEPTIONS)
-
-template <typename Pointer>
-struct are_elements_contiguous<
- boost::container::container_detail::vector_const_iterator<Pointer>
-> : boost::true_type
-{};
-
-template <typename Pointer>
-struct are_elements_contiguous<
- boost::container::container_detail::vector_iterator<Pointer>
-> : boost::true_type
-{};
-
-#if defined(BOOST_DINKUMWARE_STDLIB)
-
-template <typename T>
-struct are_elements_contiguous<
- std::_Vector_const_iterator<T>
-> : boost::true_type
-{};
-
-template <typename T>
-struct are_elements_contiguous<
- std::_Vector_iterator<T>
-> : boost::true_type
-{};
-
-#elif defined(BOOST_GNU_STDLIB)
-
-template <typename P, typename T, typename A>
-struct are_elements_contiguous<
- __gnu_cxx::__normal_iterator<P, std::vector<T, A> >
-> : boost::true_type
-{};
-
-#elif defined(_LIBCPP_VERSION)
-
-// TODO - test it first
-//template <typename P>
-//struct are_elements_contiguous<
-// __wrap_iter<P>
-//> : boost::true_type
-//{};
-
-#else // OTHER_STDLIB
-
-// TODO - add other iterators implementations
-
-#endif // STDLIB
-
-#endif // BOOST_CONTAINER_STATIC_VECTOR_ENABLE_VECTORS_OPTIMIZATION && !BOOST_NO_EXCEPTIONS
-
-}}} // namespace boost::container::static_vector_detail
-
-#endif // !BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
-
-namespace boost { namespace container { namespace static_vector_detail {
-
-// TODO
-// Does BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION checks have any sense?
-// Boost.MPL and Boost.Container might not be used but
-// Boost.Iterator also uses partial specialization
-// and in fact iterator_traits won't work if there is no partial specialization
-
-#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
-
-template <typename I, typename O>
-struct are_corresponding :
- ::boost::mpl::and_<
- ::boost::is_same<
- ::boost::remove_const<
- typename ::boost::iterator_value<I>::type
- >,
- ::boost::remove_const<
- typename ::boost::iterator_value<O>::type
- >
- >,
- are_elements_contiguous<I>,
- are_elements_contiguous<O>
- >
-{};
-
-template <typename I, typename V>
-struct is_corresponding_value :
- ::boost::is_same<
- ::boost::remove_const<
- typename ::boost::iterator_value<I>::type
- >,
- ::boost::remove_const<V>
- >
-{};
-
-// destroy(I, I)
-
-template <typename I>
-void destroy_dispatch(I /*first*/, I /*last*/,
- boost::true_type const& /*has_trivial_destructor*/)
-{}
-
-template <typename I>
-void destroy_dispatch(I first, I last,
- boost::false_type const& /*has_trivial_destructor*/)
-{
- typedef typename boost::iterator_value<I>::type value_type;
- for ( ; first != last ; ++first )
- first->~value_type();
-}
-
-template <typename I>
-void destroy(I first, I last)
-{
- typedef typename boost::iterator_value<I>::type value_type;
- destroy_dispatch(first, last, has_trivial_destructor<value_type>());
-}
-
-// destroy(I)
-
-template <typename I>
-void destroy_dispatch(I /*pos*/,
- boost::true_type const& /*has_trivial_destructor*/)
-{}
-
-template <typename I>
-void destroy_dispatch(I pos,
- boost::false_type const& /*has_trivial_destructor*/)
-{
- typedef typename boost::iterator_value<I>::type value_type;
- pos->~value_type();
-}
-
-template <typename I>
-void destroy(I pos)
-{
- typedef typename boost::iterator_value<I>::type value_type;
- destroy_dispatch(pos, has_trivial_destructor<value_type>());
-}
-
-// copy(I, I, O)
-
-template <typename I, typename O>
-inline O copy_dispatch(I first, I last, O dst,
- boost::mpl::bool_<true> const& /*use_memmove*/)
-{
- typedef typename boost::iterator_value<I>::type value_type;
- typename boost::iterator_difference<I>::type d = std::distance(first, last);
-
- ::memmove(boost::addressof(*dst), boost::addressof(*first), sizeof(value_type) * d);
- return dst + d;
-}
-
-template <typename I, typename O>
-inline O copy_dispatch(I first, I last, O dst,
- boost::mpl::bool_<false> const& /*use_memmove*/)
-{
- return std::copy(first, last, dst); // may throw
-}
-
-template <typename I, typename O>
-inline O copy(I first, I last, O dst)
-{
- typedef typename
- ::boost::mpl::and_<
- are_corresponding<I, O>,
- ::boost::has_trivial_assign<
- typename ::boost::iterator_value<O>::type
- >
- >::type
- use_memmove;
-
- return copy_dispatch(first, last, dst, use_memmove()); // may throw
-}
-
-// uninitialized_copy(I, I, O)
-
-template <typename I, typename O>
-inline
-O uninitialized_copy_dispatch(I first, I last, O dst,
- boost::mpl::bool_<true> const& /*use_memcpy*/)
-{
- typedef typename boost::iterator_value<I>::type value_type;
- typename boost::iterator_difference<I>::type d = std::distance(first, last);
-
- ::memcpy(boost::addressof(*dst), boost::addressof(*first), sizeof(value_type) * d);
- return dst + d;
-}
-
-template <typename I, typename F>
-inline
-F uninitialized_copy_dispatch(I first, I last, F dst,
- boost::mpl::bool_<false> const& /*use_memcpy*/)
-{
- return std::uninitialized_copy(first, last, dst); // may throw
-}
-
-template <typename I, typename F>
-inline
-F uninitialized_copy(I first, I last, F dst)
-{
- typedef typename
- ::boost::mpl::and_<
- are_corresponding<I, F>,
- ::boost::has_trivial_copy<
- typename ::boost::iterator_value<F>::type
- >
- >::type
- use_memcpy;
-
- return uninitialized_copy_dispatch(first, last, dst, use_memcpy()); // may throw
-}
-
-// uninitialized_move(I, I, O)
-
-template <typename I, typename O>
-inline
-O uninitialized_move_dispatch(I first, I last, O dst,
- boost::mpl::bool_<true> const& /*use_memcpy*/)
-{
- typedef typename boost::iterator_value<I>::type value_type;
- typename boost::iterator_difference<I>::type d = std::distance(first, last);
-
- ::memcpy(boost::addressof(*dst), boost::addressof(*first), sizeof(value_type) * d);
- return dst + d;
-}
-
-template <typename I, typename O>
-inline
-O uninitialized_move_dispatch(I first, I last, O dst,
- boost::mpl::bool_<false> const& /*use_memcpy*/)
-{
- //return boost::uninitialized_move(first, last, dst); // may throw
-
- O o = dst;
-
- BOOST_TRY
- {
- typedef typename std::iterator_traits<O>::value_type value_type;
- for (; first != last; ++first, ++o )
- new (boost::addressof(*o)) value_type(boost::move(*first));
- }
- BOOST_CATCH(...)
- {
- destroy(dst, o);
- BOOST_RETHROW;
- }
- BOOST_CATCH_END
-
- return dst;
-}
-
-template <typename I, typename O>
-inline
-O uninitialized_move(I first, I last, O dst)
-{
- typedef typename
- ::boost::mpl::and_<
- are_corresponding<I, O>,
- ::boost::has_trivial_copy<
- typename ::boost::iterator_value<O>::type
- >
- >::type
- use_memcpy;
-
- return uninitialized_move_dispatch(first, last, dst, use_memcpy()); // may throw
-}
-
-// TODO - move uses memmove - implement 2nd version using memcpy?
-
-// move(I, I, O)
-
-template <typename I, typename O>
-inline
-O move_dispatch(I first, I last, O dst,
- boost::mpl::bool_<true> const& /*use_memmove*/)
-{
- typedef typename boost::iterator_value<I>::type value_type;
- typename boost::iterator_difference<I>::type d = std::distance(first, last);
-
- ::memmove(boost::addressof(*dst), boost::addressof(*first), sizeof(value_type) * d);
- return dst + d;
-}
-
-template <typename I, typename O>
-inline
-O move_dispatch(I first, I last, O dst,
- boost::mpl::bool_<false> const& /*use_memmove*/)
-{
- return boost::move(first, last, dst); // may throw
-}
-
-template <typename I, typename O>
-inline
-O move(I first, I last, O dst)
-{
- typedef typename
- ::boost::mpl::and_<
- are_corresponding<I, O>,
- ::boost::has_trivial_assign<
- typename ::boost::iterator_value<O>::type
- >
- >::type
- use_memmove;
-
- return move_dispatch(first, last, dst, use_memmove()); // may throw
-}
-
-// move_backward(BDI, BDI, BDO)
-
-template <typename BDI, typename BDO>
-inline
-BDO move_backward_dispatch(BDI first, BDI last, BDO dst,
- boost::mpl::bool_<true> const& /*use_memmove*/)
-{
- typedef typename boost::iterator_value<BDI>::type value_type;
- typename boost::iterator_difference<BDI>::type d = std::distance(first, last);
-
- BDO foo(dst - d);
- ::memmove(boost::addressof(*foo), boost::addressof(*first), sizeof(value_type) * d);
- return foo;
-}
-
-template <typename BDI, typename BDO>
-inline
-BDO move_backward_dispatch(BDI first, BDI last, BDO dst,
- boost::mpl::bool_<false> const& /*use_memmove*/)
-{
- return boost::move_backward(first, last, dst); // may throw
-}
-
-template <typename BDI, typename BDO>
-inline
-BDO move_backward(BDI first, BDI last, BDO dst)
-{
- typedef typename
- ::boost::mpl::and_<
- are_corresponding<BDI, BDO>,
- ::boost::has_trivial_assign<
- typename ::boost::iterator_value<BDO>::type
- >
- >::type
- use_memmove;
-
- return move_backward_dispatch(first, last, dst, use_memmove()); // may throw
-}
-
-template <typename T>
-struct has_nothrow_move : public
- ::boost::mpl::or_<
- boost::mpl::bool_<
- ::boost::has_nothrow_move<
- typename ::boost::remove_const<T>::type
- >::value
- >,
- boost::mpl::bool_<
- ::boost::has_nothrow_move<T>::value
- >
- >
-{};
-
-// uninitialized_move_if_noexcept(I, I, O)
-
-template <typename I, typename O>
-inline
-O uninitialized_move_if_noexcept_dispatch(I first, I last, O dst, boost::mpl::bool_<true> const& /*use_move*/)
-{ return uninitialized_move(first, last, dst); }
-
-template <typename I, typename O>
-inline
-O uninitialized_move_if_noexcept_dispatch(I first, I last, O dst, boost::mpl::bool_<false> const& /*use_move*/)
-{ return uninitialized_copy(first, last, dst); }
-
-template <typename I, typename O>
-inline
-O uninitialized_move_if_noexcept(I first, I last, O dst)
-{
- typedef typename has_nothrow_move<
- typename ::boost::iterator_value<O>::type
- >::type use_move;
-
- return uninitialized_move_if_noexcept_dispatch(first, last, dst, use_move()); // may throw
-}
-
-// move_if_noexcept(I, I, O)
-
-template <typename I, typename O>
-inline
-O move_if_noexcept_dispatch(I first, I last, O dst, boost::mpl::bool_<true> const& /*use_move*/)
-{ return move(first, last, dst); }
-
-template <typename I, typename O>
-inline
-O move_if_noexcept_dispatch(I first, I last, O dst, boost::mpl::bool_<false> const& /*use_move*/)
-{ return copy(first, last, dst); }
-
-template <typename I, typename O>
-inline
-O move_if_noexcept(I first, I last, O dst)
-{
- typedef typename has_nothrow_move<
- typename ::boost::iterator_value<O>::type
- >::type use_move;
-
- return move_if_noexcept_dispatch(first, last, dst, use_move()); // may throw
-}
-
-// uninitialized_fill(I, I)
-
-template <typename I>
-inline
-void uninitialized_fill_dispatch(I /*first*/, I /*last*/,
- boost::true_type const& /*has_trivial_constructor*/)
-{}
-
-template <typename I>
-inline
-void uninitialized_fill_dispatch(I first, I last,
- boost::false_type const& /*has_trivial_constructor*/)
-{
- typedef typename boost::iterator_value<I>::type value_type;
- I it = first;
-
- BOOST_TRY
- {
- for ( ; it != last ; ++it )
- new (boost::addressof(*it)) value_type(); // may throw
- }
- BOOST_CATCH(...)
- {
- destroy(first, it);
- BOOST_RETHROW;
- }
- BOOST_CATCH_END
-}
-
-template <typename I>
-inline
-void uninitialized_fill(I first, I last)
-{
- typedef typename boost::iterator_value<I>::type value_type;
- uninitialized_fill_dispatch(first, last, has_trivial_constructor<value_type>()); // may throw
-}
-
-// construct(I, V)
-
-template <typename I, typename V>
-inline
-void construct_dispatch(I pos, V const& v,
- boost::mpl::bool_<true> const& /*use_memcpy*/)
-{
- ::memcpy(boost::addressof(*pos), boost::addressof(v), sizeof(V));
-}
-
-template <typename I, typename P>
-inline
-void construct_dispatch(I pos, P const& p,
- boost::mpl::bool_<false> const& /*use_memcpy*/)
-{
- typedef typename boost::iterator_value<I>::type V;
- new (static_cast<void*>(boost::addressof(*pos))) V(p); // may throw
-}
-
-template <typename I, typename P>
-inline
-void construct(I pos, P const& p)
-{
- typedef typename
- ::boost::mpl::and_<
- is_corresponding_value<I, P>,
- ::boost::has_trivial_copy<P>
- >::type
- use_memcpy;
-
- construct_dispatch(pos, p, use_memcpy()); // may throw
-}
-
-// Needed by push_back(V &&)
-
-template <typename I, typename P>
-inline
-void construct(I pos, BOOST_RV_REF(P) p)
-{
- typedef typename
- ::boost::mpl::and_<
- is_corresponding_value<I, P>,
- ::boost::has_trivial_copy<P>
- >::type
- use_memcpy;
-
- typedef typename boost::iterator_value<I>::type V;
- new (static_cast<void*>(boost::addressof(*pos))) V(p); // may throw
-}
-
-// Needed by emplace_back() and emplace()
-
-#if !defined(BOOST_CONTAINER_STATIC_VECTOR_DISABLE_EMPLACE)
-#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
-
-template <typename I, class ...Args>
-inline
-void construct(I pos, BOOST_FWD_REF(Args) ...args)
-{
- typedef typename boost::iterator_value<I>::type V;
- new (static_cast<void*>(boost::addressof(*pos))) V(::boost::forward<Args>(args)...); // may throw
-}
-
-#else // !BOOST_NO_VARIADIC_TEMPLATES
-
-// BOOST_NO_RVALUE_REFERENCES -> P0 const& p0
-// !BOOST_NO_RVALUE_REFERENCES -> P0 && p0
-// which means that version with one parameter may take V const& v
-
-#define BOOST_PP_LOCAL_MACRO(n) \
-template <typename I, typename P BOOST_PP_ENUM_TRAILING_PARAMS(n, typename P) > \
-inline \
-void construct(I pos, \
- BOOST_CONTAINER_PP_PARAM(P, p) \
- BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
-{ \
- typedef typename boost::iterator_value<I>::type V; \
- new \
- (static_cast<void*>(boost::addressof(*pos))) \
- V(p, BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); /*may throw*/ \
-} \
-//
-#define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
-#include BOOST_PP_LOCAL_ITERATE()
-
-#endif // !BOOST_NO_VARIADIC_TEMPLATES
-#endif // !BOOST_CONTAINER_STATIC_VECTOR_DISABLE_EMPLACE
-
-// assign(I, V)
-
-template <typename I, typename V>
-inline
-void assign_dispatch(I pos, V const& v,
- boost::mpl::bool_<true> const& /*use_memcpy*/)
-{
- ::memcpy(boost::addressof(*pos), boost::addressof(v), sizeof(V));
-}
-
-template <typename I, typename V>
-inline
-void assign_dispatch(I pos, V const& v,
- boost::mpl::bool_<false> const& /*use_memcpy*/)
-{
- *pos = v; // may throw
-}
-
-template <typename I, typename V>
-inline
-void assign(I pos, V const& v)
-{
- typedef typename
- ::boost::mpl::and_<
- is_corresponding_value<I, V>,
- ::boost::has_trivial_assign<V>
- >::type
- use_memcpy;
-
- assign_dispatch(pos, v, use_memcpy()); // may throw
-}
-
-template <typename I, typename V>
-inline
-void assign(I pos, BOOST_RV_REF(V) v)
-{
- *pos = v; // may throw
-}
-
-#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
-
-template <typename I, typename O>
-inline O copy(I first, I last, O dst)
-{
- return std::copy(first, last, dst); // may throw
-}
-
-template <typename I, typename F>
-inline F uninitialized_copy(I first, I last, F dst)
-{
- return std::uninitialized_copy(first, last, dst); // may throw
-}
-
-template <typename I, typename O>
-inline O move(I first, I last, O dst)
-{
- return std::copy(first, last, dst); // may throw
-}
-
-template <typename BDI, typename BDO>
-inline BDO move_backward(BDI first, BDI last, BDO dst)
-{
- return std::copy_backward(first, last, dst); // may throw
-}
-
-template <typename I, typename O>
-inline O uninitialized_move(I first, I last, O dst)
-{
- //return boost::uninitialized_move(first, last, dst); // may throw
-
- O o = dst;
-
- BOOST_TRY
- {
- typedef typename std::iterator_traits<O>::value_type value_type;
- for (; first != last; ++first, ++o )
- new (boost::addressof(*o)) value_type(boost::move(*first));
- }
- BOOST_CATCH(...)
- {
- destroy(dst, o);
- BOOST_RETHROW;
- }
- BOOST_CATCH_END
-
- return dst;
-}
-
-template <typename I, typename O>
-inline O uninitialized_move_if_noexcept(I first, I last, O dst)
-{
- return uninitialized_copy(first, last, dst); // may throw
-}
-
-template <typename I, typename O>
-inline O move_if_noexcept(I first, I last, O dst)
-{
- return copy(first, last, dst); // may throw
-}
-
-template <typename I>
-inline void destroy(I first, I last)
-{
- typedef typename boost::iterator_value<I>::type value_type;
- for ( ; first != last ; ++first )
- first->~value_type();
-}
-
-template <typename I>
-inline void destroy(I pos)
-{
- typedef typename boost::iterator_value<I>::type value_type;
- pos->~value_type();
-}
-
-template <typename I>
-inline void uninitialized_fill(I first, I last)
-{
- typedef typename boost::iterator_value<I>::type value_type;
- I it = first;
-
- BOOST_TRY
- {
- for ( ; it != last ; ++it )
- new (boost::addressof(*it)) value_type(); // may throw
- }
- BOOST_CATCH(...)
- {
- destroy(first, it);
- BOOST_RETHROW;
- }
- BOOST_CATCH_END
-}
-
-template <typename I, typename V>
-inline void construct(I pos, V const& v)
-{
- new (static_cast<void*>(boost::addressof(*pos))) V(v); // may throw
-}
-
-template <typename I, typename V>
-inline void assign(I pos, V const& v)
-{
- *pos = v; // may throw
-}
-
-#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
-
-// uninitialized_copy_s
-
-template <typename I, typename F>
-inline std::size_t uninitialized_copy_s(I first, I last, F dest, std::size_t max_count)
-{
- std::size_t count = 0;
- F it = dest;
-
- BOOST_TRY
- {
- for ( ; first != last ; ++it, ++first, ++count )
- {
- if ( max_count <= count )
- return (std::numeric_limits<std::size_t>::max)();
-
- construct(it, *first); // may throw
- }
- }
- BOOST_CATCH(...)
- {
- destroy(dest, it);
- BOOST_RETHROW;
- }
- BOOST_CATCH_END
-
- return count;
-}
-
-// scoped_destructor
-
-template<class T>
-class scoped_destructor
-{
-public:
- scoped_destructor(T * ptr) : m_ptr(ptr) {}
-
- ~scoped_destructor()
- {
- if(m_ptr)
- destroy(m_ptr);
- }
-
- void release() { m_ptr = 0; }
-
-private:
- T * m_ptr;
-};
-
-}}} // namespace boost::container::static_vector_detail
-
-#endif // BOOST_CONTAINER_DETAIL_STATIC_VECTOR_UTIL_HPP

Added: sandbox/varray/boost/container/detail/varray.hpp
==============================================================================
--- (empty file)
+++ sandbox/varray/boost/container/detail/varray.hpp 2013-01-26 22:36:10 EST (Sat, 26 Jan 2013)
@@ -0,0 +1,2266 @@
+// Boost.Container varray
+//
+// Copyright (c) 2012-2013 Adam Wulkiewicz, Lodz, Poland.
+// Copyright (c) 2011-2013 Andrew Hundt.
+//
+// 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)
+
+#ifndef BOOST_CONTAINER_DETAIL_VARRAY_HPP
+#define BOOST_CONTAINER_DETAIL_VARRAY_HPP
+
+#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif
+
+#include <boost/container/detail/config_begin.hpp>
+#include <boost/container/detail/workaround.hpp>
+#include <boost/container/detail/preprocessor.hpp>
+
+#include <boost/container/detail/varray_util.hpp>
+#include <boost/container/detail/varray_concept.hpp>
+#include <boost/iterator/iterator_concepts.hpp>
+
+#ifndef BOOST_NO_EXCEPTIONS
+#include <stdexcept>
+#endif // BOOST_NO_EXCEPTIONS
+
+#include <boost/assert.hpp>
+#include <boost/config.hpp>
+#include <boost/swap.hpp>
+#include <boost/integer.hpp>
+
+#include <boost/mpl/assert.hpp>
+
+#include <boost/type_traits/is_unsigned.hpp>
+#include <boost/type_traits/alignment_of.hpp>
+#include <boost/type_traits/aligned_storage.hpp>
+
+// TODO - use std::reverse_iterator and std::iterator_traits
+// instead Boost.Iterator to remove dependency?
+// or boost/detail/iterator.hpp ?
+#include <boost/iterator/reverse_iterator.hpp>
+
+/**
+ * @defgroup varray_non_member varray non-member functions (boost::container::)
+ */
+
+namespace boost { namespace container { namespace container_detail {
+
+// Forward declaration
+template <typename Value, std::size_t Capacity, typename Strategy>
+class varray;
+
+namespace strategy {
+
+// TODO: Improve error messages
+// possibly include N in the strategy, and provide size as an optoinal allocate_failed parameter?
+// Example of current error with reserve(4) when capacity is 3:
+// "boost/container/varray.hpp(66): size can't exceed the capacity"
+// Could say
+// "cannot reserve(4) due to fixed capacity of 3 elements"
+
+//! @brief The default strategy.
+//!
+//! @tparam Value Type of element stored in the container.
+template <typename Value>
+struct def
+{
+ typedef Value value_type;
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef Value* pointer;
+ typedef const Value* const_pointer;
+ typedef Value& reference;
+ typedef const Value& const_reference;
+
+ static void allocate_failed()
+ {
+ BOOST_ASSERT_MSG(false, "size can't exceed the capacity");
+ }
+};
+
+//! @brief The strategy adapting info from passed Allocator.
+//!
+//! This strategy defines the same types that are defined in the Allocator.
+//!
+//! @tparam Allocator The Allocator which will be adapted.
+template <typename Allocator>
+struct allocator_adaptor
+{
+ typedef typename Allocator::value_type value_type;
+ typedef typename Allocator::size_type size_type;
+ typedef typename Allocator::difference_type difference_type;
+ typedef typename Allocator::pointer pointer;
+ typedef typename Allocator::const_pointer const_pointer;
+ typedef typename Allocator::reference reference;
+ typedef typename Allocator::const_reference const_reference;
+
+ static void allocate_failed()
+ {
+ BOOST_ASSERT_MSG(false, "size can't exceed the capacity");
+ }
+};
+
+} // namespace strategy
+
+struct varray_error_handler
+{
+ template <typename V, std::size_t Capacity, typename S>
+ static void check_capacity(varray<V, Capacity, S> const&, std::size_t s)
+ {
+ if ( Capacity < s )
+ S::allocate_failed();
+ }
+
+ template <typename V, std::size_t C, typename S>
+ static void check_at(varray<V, C, S> const& v,
+ typename varray<V, C, S>::size_type i)
+ {
+// TODO - use BOOST_THROW_EXCEPTION here?
+#ifndef BOOST_NO_EXCEPTIONS
+ if ( v.size() <= i )
+ throw std::out_of_range("index out of bounds");
+#else // BOOST_NO_EXCEPTIONS
+ BOOST_ASSERT_MSG(i < v.size(), "index out of bounds");
+#endif // BOOST_NO_EXCEPTIONS
+ }
+
+ template <typename V, std::size_t C, typename S>
+ static void check_operator_brackets(varray<V, C, S> const& v,
+ typename varray<V, C, S>::size_type i)
+ {
+ BOOST_ASSERT_MSG(i < v.size(), "index out of bounds");
+ }
+
+ template <typename V, std::size_t C, typename S>
+ static void check_empty(varray<V, C, S> const& v)
+ {
+ BOOST_ASSERT_MSG(0 < v.size(), "the container is empty");
+ }
+
+ template <typename V, std::size_t C, typename S>
+ static void check_iterator_end_neq(varray<V, C, S> const& v,
+ typename varray<V, C, S>::const_iterator position)
+ {
+ BOOST_ASSERT_MSG(v.begin() <= position && position < v.end(), "iterator out of bounds");
+ }
+
+ template <typename V, std::size_t C, typename S>
+ static void check_iterator_end_eq(varray<V, C, S> const& v,
+ typename varray<V, C, S>::const_iterator position)
+ {
+ BOOST_ASSERT_MSG(v.begin() <= position && position <= v.end(), "iterator out of bounds");
+ }
+};
+
+template <typename Value, std::size_t Capacity, typename Strategy>
+struct varray_traits
+{
+ typedef typename Strategy::value_type value_type;
+ typedef typename Strategy::size_type size_type;
+ typedef typename Strategy::difference_type difference_type;
+ typedef typename Strategy::pointer pointer;
+ typedef typename Strategy::const_pointer const_pointer;
+ typedef typename Strategy::reference reference;
+ typedef typename Strategy::const_reference const_reference;
+
+ typedef varray_error_handler error_handler;
+
+ typedef boost::false_type use_memop_in_swap_and_move;
+ typedef boost::false_type use_optimized_swap;
+};
+
+/**
+ * @brief A variable-size array container with fixed capacity.
+ *
+ * varray is a sequence container like boost::container::vector with contiguous storage that can
+ * change in size, along with the static allocation, low overhead, and fixed capacity of boost::array.
+ *
+ * A varray is a sequence that supports random access to elements, constant time insertion and
+ * removal of elements at the end, and linear time insertion and removal of elements at the beginning or
+ * in the middle. The number of elements in a varray may vary dynamically up to a fixed capacity
+ * because elements are stored within the object itself similarly to an array. However, objects are
+ * initialized as they are inserted into varray unlike C arrays or std::array which must construct
+ * all elements on instantiation. The behavior of varray enables the use of statically allocated
+ * elements in cases with complex object lifetime requirements that would otherwise not be trivially
+ * possible.
+ *
+ * @par Error Handling
+ * Insertion beyond the capacity and out of bounds errors result in undefined behavior unless
+ * otherwise specified. In this respect if size() == capacity(), then varray::push_back()
+ * behaves like std::vector pop_front() if size() == empty(). The reason for this difference
+ * is because unlike vectors, varray does not perform allocation.
+ *
+ * @par Advanced Usage
+ * Error handling behavior can be modified to more closely match std::vector exception behavior
+ * when exceeding bounds by providing an alternate Strategy and varray_traits instantiation.
+ *
+ * @tparam Value The type of element that will be stored.
+ * @tparam Capacity The maximum number of elements varray can store, fixed at compile time.
+ * @tparam Strategy Defines the public typedefs and error handlers,
+ * implements StaticVectorStrategy and has some similarities
+ * to an Allocator.
+ */
+template <typename Value, std::size_t Capacity, typename Strategy = strategy::def<Value> >
+class varray
+{
+ typedef container_detail::varray_traits<
+ Value, Capacity, Strategy
+ > vt;
+
+ typedef typename vt::error_handler errh;
+
+ BOOST_MPL_ASSERT_MSG(
+ ( boost::is_unsigned<typename vt::size_type>::value &&
+ sizeof(typename boost::uint_value_t<Capacity>::least) <= sizeof(typename vt::size_type) ),
+ SIZE_TYPE_IS_TOO_SMALL_FOR_SPECIFIED_CAPACITY,
+ (varray)
+ );
+
+ BOOST_CONCEPT_ASSERT((concept::VArrayStrategy<Strategy>));
+
+ typedef boost::aligned_storage<
+ sizeof(Value[Capacity]),
+ boost::alignment_of<Value[Capacity]>::value
+ > aligned_storage_type;
+
+ template <typename V, std::size_t C, typename S>
+ friend class varray;
+
+ BOOST_COPYABLE_AND_MOVABLE(varray)
+
+#ifdef BOOST_NO_RVALUE_REFERENCES
+public:
+ template <std::size_t C, typename S>
+ varray & operator=(varray<Value, C, S> & sv)
+ {
+ typedef varray<Value, C, S> other;
+ this->operator=(static_cast<const ::boost::rv<other> &>(const_cast<const other &>(sv)));
+ return *this;
+ }
+#endif
+
+public:
+ //! @brief The type of elements stored in the container.
+ typedef typename vt::value_type value_type;
+ //! @brief The unsigned integral type used by the container.
+ typedef typename vt::size_type size_type;
+ //! @brief The pointers difference type.
+ typedef typename vt::difference_type difference_type;
+ //! @brief The pointer type.
+ typedef typename vt::pointer pointer;
+ //! @brief The const pointer type.
+ typedef typename vt::const_pointer const_pointer;
+ //! @brief The value reference type.
+ typedef typename vt::reference reference;
+ //! @brief The value const reference type.
+ typedef typename vt::const_reference const_reference;
+
+ //! @brief The iterator type.
+ typedef pointer iterator;
+ //! @brief The const iterator type.
+ typedef const_pointer const_iterator;
+ //! @brief The reverse iterator type.
+ typedef boost::reverse_iterator<iterator> reverse_iterator;
+ //! @brief The const reverse iterator.
+ typedef boost::reverse_iterator<const_iterator> const_reverse_iterator;
+
+ //! @brief The type of a strategy used by the varray.
+ typedef Strategy strategy_type;
+
+ //! @brief Constructs an empty varray.
+ //!
+ //! @par Throws
+ //! Nothing.
+ //!
+ //! @par Complexity
+ //! Constant O(1).
+ varray()
+ : m_size(0)
+ {}
+
+ //! @pre <tt>count <= capacity()</tt>
+ //!
+ //! @brief Constructs a varray containing count default constructed Values.
+ //!
+ //! @param count The number of values which will be contained in the container.
+ //!
+ //! @par Throws
+ //! If Value's default constructor throws.
+ //! @internal
+ //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
+ //! @endinternal
+ //!
+ //! @par Complexity
+ //! Linear O(N).
+ explicit varray(size_type count)
+ : m_size(0)
+ {
+ this->resize(count); // may throw
+ }
+
+ //! @pre <tt>count <= capacity()</tt>
+ //!
+ //! @brief Constructs a varray containing count copies of value.
+ //!
+ //! @param count The number of copies of a values that will be contained in the container.
+ //! @param value The value which will be used to copy construct values.
+ //!
+ //! @par Throws
+ //! If Value's copy constructor throws.
+ //! @internal
+ //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
+ //! @endinternal
+ //!
+ //! @par Complexity
+ //! Linear O(N).
+ varray(size_type count, value_type const& value)
+ : m_size(0)
+ {
+ this->resize(count, value); // may throw
+ }
+
+ //! @pre
+ //! @li <tt>distance(first, last) <= capacity()</tt>
+ //! @li Iterator must meet the \c ForwardTraversalIterator concept.
+ //!
+ //! @brief Constructs a varray containing copy of a range <tt>[first, last)</tt>.
+ //!
+ //! @param first The iterator to the first element in range.
+ //! @param last The iterator to the one after the last element in range.
+ //!
+ //! @par Throws
+ //! If Value's constructor taking a dereferenced Iterator throws.
+ //! @internal
+ //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
+ //! @endinternal
+ //!
+ //! @par Complexity
+ //! Linear O(N).
+ template <typename Iterator>
+ varray(Iterator first, Iterator last)
+ : m_size(0)
+ {
+ BOOST_CONCEPT_ASSERT((boost_concepts::ForwardTraversal<Iterator>)); // Make sure you passed a ForwardIterator
+
+ this->assign(first, last); // may throw
+ }
+
+ //! @brief Constructs a copy of other varray.
+ //!
+ //! @param other The varray which content will be copied to this one.
+ //!
+ //! @par Throws
+ //! If Value's copy constructor throws.
+ //!
+ //! @par Complexity
+ //! Linear O(N).
+ varray(varray const& other)
+ : m_size(other.size())
+ {
+ namespace sv = varray_detail;
+ sv::uninitialized_copy(other.begin(), other.end(), this->begin()); // may throw
+ }
+
+ //! @pre <tt>other.size() <= capacity()</tt>.
+ //!
+ //! @brief Constructs a copy of other varray.
+ //!
+ //! @param other The varray which content will be copied to this one.
+ //!
+ //! @par Throws
+ //! If Value's copy constructor throws.
+ //! @internal
+ //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
+ //! @endinternal
+ //!
+ //! @par Complexity
+ //! Linear O(N).
+ template <std::size_t C, typename S>
+ varray(varray<value_type, C, S> const& other)
+ : m_size(other.size())
+ {
+ errh::check_capacity(*this, other.size()); // may throw
+
+ namespace sv = varray_detail;
+ sv::uninitialized_copy(other.begin(), other.end(), this->begin()); // may throw
+ }
+
+ //! @brief Copy assigns Values stored in the other varray to this one.
+ //!
+ //! @param other The varray which content will be copied to this one.
+ //!
+ //! @par Throws
+ //! If Value's copy constructor or copy assignment throws.
+ //!
+ //! @par Complexity
+ //! Linear O(N).
+ varray & operator=(BOOST_COPY_ASSIGN_REF(varray) other)
+ {
+ this->assign(other.begin(), other.end()); // may throw
+
+ return *this;
+ }
+
+ //! @pre <tt>other.size() <= capacity()</tt>
+ //!
+ //! @brief Copy assigns Values stored in the other varray to this one.
+ //!
+ //! @param other The varray which content will be copied to this one.
+ //!
+ //! @par Throws
+ //! If Value's copy constructor or copy assignment throws.
+ //! @internal
+ //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
+ //! @endinternal
+ //!
+ //! @par Complexity
+ //! Linear O(N).
+ template <std::size_t C, typename S>
+// TEMPORARY WORKAROUND
+#if defined(BOOST_NO_RVALUE_REFERENCES)
+ varray & operator=(::boost::rv< varray<value_type, C, S> > const& other)
+#else
+ varray & operator=(varray<value_type, C, S> const& other)
+#endif
+ {
+ this->assign(other.begin(), other.end()); // may throw
+
+ return *this;
+ }
+
+ //! @brief Move constructor. Moves Values stored in the other varray to this one.
+ //!
+ //! @param other The varray which content will be moved to this one.
+ //!
+ //! @par Throws
+ //! @li If \c boost::has_nothrow_move<Value>::value is \c true and Value's move constructor throws.
+ //! @li If \c boost::has_nothrow_move<Value>::value is \c false and Value's copy constructor throws.
+ //! @internal
+ //! @li It throws only if \c use_memop_in_swap_and_move is \c false_type - default.
+ //! @endinternal
+ //!
+ //! @par Complexity
+ //! Linear O(N).
+ varray(BOOST_RV_REF(varray) other)
+ {
+ typedef typename
+ vt::use_memop_in_swap_and_move use_memop_in_swap_and_move;
+
+ this->move_ctor_dispatch(other, use_memop_in_swap_and_move());
+ }
+
+ //! @pre <tt>other.size() <= capacity()</tt>
+ //!
+ //! @brief Move constructor. Moves Values stored in the other varray to this one.
+ //!
+ //! @param other The varray which content will be moved to this one.
+ //!
+ //! @par Throws
+ //! @li If \c boost::has_nothrow_move<Value>::value is \c true and Value's move constructor throws.
+ //! @li If \c boost::has_nothrow_move<Value>::value is \c false and Value's copy constructor throws.
+ //! @internal
+ //! @li It throws only if \c use_memop_in_swap_and_move is false_type - default.
+ //! @endinternal
+ //! @internal
+ //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
+ //! @endinternal
+ //!
+ //! @par Complexity
+ //! Linear O(N).
+ template <std::size_t C, typename S>
+ varray(BOOST_RV_REF_3_TEMPL_ARGS(varray, value_type, C, S) other)
+ : m_size(other.m_size)
+ {
+ errh::check_capacity(*this, other.size()); // may throw
+
+ typedef typename
+ vt::use_memop_in_swap_and_move use_memop_in_swap_and_move;
+
+ this->move_ctor_dispatch(other, use_memop_in_swap_and_move());
+ }
+
+ //! @brief Move assignment. Moves Values stored in the other varray to this one.
+ //!
+ //! @param other The varray which content will be moved to this one.
+ //!
+ //! @par Throws
+ //! @li If \c boost::has_nothrow_move<Value>::value is \c true and Value's move constructor or move assignment throws.
+ //! @li If \c boost::has_nothrow_move<Value>::value is \c false and Value's copy constructor or copy assignment throws.
+ //! @internal
+ //! @li It throws only if \c use_memop_in_swap_and_move is \c false_type - default.
+ //! @endinternal
+ //!
+ //! @par Complexity
+ //! Linear O(N).
+ varray & operator=(BOOST_RV_REF(varray) other)
+ {
+ if ( &other == this )
+ return *this;
+
+ typedef typename
+ vt::use_memop_in_swap_and_move use_memop_in_swap_and_move;
+
+ this->move_assign_dispatch(other, use_memop_in_swap_and_move());
+
+ return *this;
+ }
+
+ //! @pre <tt>other.size() <= capacity()</tt>
+ //!
+ //! @brief Move assignment. Moves Values stored in the other varray to this one.
+ //!
+ //! @param other The varray which content will be moved to this one.
+ //!
+ //! @par Throws
+ //! @li If \c boost::has_nothrow_move<Value>::value is \c true and Value's move constructor or move assignment throws.
+ //! @li If \c boost::has_nothrow_move<Value>::value is \c false and Value's copy constructor or copy assignment throws.
+ //! @internal
+ //! @li It throws only if \c use_memop_in_swap_and_move is \c false_type - default.
+ //! @endinternal
+ //! @internal
+ //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
+ //! @endinternal
+ //!
+ //! @par Complexity
+ //! Linear O(N).
+ template <std::size_t C, typename S>
+ varray & operator=(BOOST_RV_REF_3_TEMPL_ARGS(varray, value_type, C, S) other)
+ {
+ errh::check_capacity(*this, other.size()); // may throw
+
+ typedef typename
+ vt::use_memop_in_swap_and_move use_memop_in_swap_and_move;
+
+ this->move_assign_dispatch(other, use_memop_in_swap_and_move());
+
+ return *this;
+ }
+
+ //! @brief Destructor. Destroys Values stored in this container.
+ //!
+ //! @par Throws
+ //! Nothing
+ //!
+ //! @par Complexity
+ //! Linear O(N).
+ ~varray()
+ {
+ namespace sv = varray_detail;
+ sv::destroy(this->begin(), this->end());
+ }
+
+ //! @brief Swaps contents of the other varray and this one.
+ //!
+ //! @param other The varray which content will be swapped with this one's content.
+ //!
+ //! @par Throws
+ //! @li If \c boost::has_nothrow_move<Value>::value is \c true and Value's move constructor or move assignment throws,
+ //! @li If \c boost::has_nothrow_move<Value>::value is \c false and Value's copy constructor or copy assignment throws,
+ //! @internal
+ //! @li It throws only if \c use_memop_in_swap_and_move and \c use_optimized_swap are \c false_type - default.
+ //! @endinternal
+ //!
+ //! @par Complexity
+ //! Linear O(N).
+ void swap(varray & other)
+ {
+ typedef typename
+ vt::use_optimized_swap use_optimized_swap;
+
+ this->swap_dispatch(other, use_optimized_swap());
+ }
+
+ //! @pre <tt>other.size() <= capacity() && size() <= other.capacity()</tt>
+ //!
+ //! @brief Swaps contents of the other varray and this one.
+ //!
+ //! @param other The varray which content will be swapped with this one's content.
+ //!
+ //! @par Throws
+ //! @li If \c boost::has_nothrow_move<Value>::value is \c true and Value's move constructor or move assignment throws,
+ //! @li If \c boost::has_nothrow_move<Value>::value is \c false and Value's copy constructor or copy assignment throws,
+ //! @internal
+ //! @li It throws only if \c use_memop_in_swap_and_move and \c use_optimized_swap are \c false_type - default.
+ //! @endinternal
+ //! @internal
+ //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
+ //! @endinternal
+ //!
+ //! @par Complexity
+ //! Linear O(N).
+ template <std::size_t C, typename S>
+ void swap(varray<value_type, C, S> & other)
+ {
+ errh::check_capacity(*this, other.size());
+ errh::check_capacity(other, this->size());
+
+ typedef typename
+ vt::use_optimized_swap use_optimized_swap;
+
+ this->swap_dispatch(other, use_optimized_swap());
+ }
+
+ //! @pre <tt>count <= capacity()</tt>
+ //!
+ //! @brief Inserts or erases elements at the end such that
+ //! the size becomes count. New elements are default constructed.
+ //!
+ //! @param count The number of elements which will be stored in the container.
+ //!
+ //! @par Throws
+ //! If Value's default constructor throws.
+ //! @internal
+ //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
+ //! @endinternal
+ //!
+ //! @par Complexity
+ //! Linear O(N).
+ void resize(size_type count)
+ {
+ namespace sv = varray_detail;
+
+ if ( count < m_size )
+ {
+ sv::destroy(this->begin() + count, this->end());
+ }
+ else
+ {
+ errh::check_capacity(*this, count); // may throw
+
+ sv::uninitialized_fill(this->end(), this->begin() + count); // may throw
+ }
+ m_size = count; // update end
+ }
+
+ //! @pre <tt>count <= capacity()</tt>
+ //!
+ //! @brief Inserts or erases elements at the end such that
+ //! the size becomes count. New elements are copy constructed from value.
+ //!
+ //! @param count The number of elements which will be stored in the container.
+ //! @param value The value used to copy construct the new element.
+ //!
+ //! @par Throws
+ //! If Value's copy constructor throws.
+ //! @internal
+ //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
+ //! @endinternal
+ //!
+ //! @par Complexity
+ //! Linear O(N).
+ void resize(size_type count, value_type const& value)
+ {
+ if ( count < m_size )
+ {
+ namespace sv = varray_detail;
+ sv::destroy(this->begin() + count, this->end());
+ }
+ else
+ {
+ errh::check_capacity(*this, count); // may throw
+
+ std::uninitialized_fill(this->end(), this->begin() + count, value); // may throw
+ }
+ m_size = count; // update end
+ }
+
+ //! @pre <tt>count <= capacity()</tt>
+ //!
+ //! @brief This call has no effect because the Capacity of this container is constant.
+ //!
+ //! @param count The number of elements which the container should be able to contain.
+ //!
+ //! @par Throws
+ //! Nothing.
+ //! @internal
+ //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
+ //! @endinternal
+ //!
+ //! @par Complexity
+ //! Linear O(N).
+ void reserve(size_type count)
+ {
+ errh::check_capacity(*this, count); // may throw
+ }
+
+ //! @pre <tt>size() < capacity()</tt>
+ //!
+ //! @brief Adds a copy of value at the end.
+ //!
+ //! @param value The value used to copy construct the new element.
+ //!
+ //! @par Throws
+ //! If Value's copy constructor throws.
+ //! @internal
+ //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
+ //! @endinternal
+ //!
+ //! @par Complexity
+ //! Constant O(1).
+ void push_back(value_type const& value)
+ {
+ errh::check_capacity(*this, m_size + 1); // may throw
+
+ namespace sv = varray_detail;
+ sv::construct(this->end(), value); // may throw
+ ++m_size; // update end
+ }
+
+ //! @pre <tt>size() < capacity()</tt>
+ //!
+ //! @brief Moves value to the end.
+ //!
+ //! @param value The value to move construct the new element.
+ //!
+ //! @par Throws
+ //! If Value's move constructor throws.
+ //! @internal
+ //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
+ //! @endinternal
+ //!
+ //! @par Complexity
+ //! Constant O(1).
+ void push_back(BOOST_RV_REF(value_type) value)
+ {
+ errh::check_capacity(*this, m_size + 1); // may throw
+
+ namespace sv = varray_detail;
+ sv::construct(this->end(), value); // may throw
+ ++m_size; // update end
+ }
+
+ //! @pre <tt>!empty()</tt>
+ //!
+ //! @brief Destroys last value and decreases the size.
+ //!
+ //! @par Throws
+ //! Nothing by default.
+ //!
+ //! @par Complexity
+ //! Constant O(1).
+ void pop_back()
+ {
+ errh::check_empty(*this);
+
+ namespace sv = varray_detail;
+ sv::destroy(this->end() - 1);
+ --m_size; // update end
+ }
+
+ //! @pre
+ //! @li \c position must be a valid iterator of \c *this in range <tt>[begin(), end()]</tt>.
+ //! @li <tt>size() < capacity()</tt>
+ //!
+ //! @brief Inserts a copy of element at position.
+ //!
+ //! @param position The position at which the new value will be inserted.
+ //! @param value The value used to copy construct the new element.
+ //!
+ //! @par Throws
+ //! @li If Value's copy constructor or copy assignment throws
+ //! @li If Value's move constructor or move assignment throws.
+ //! @internal
+ //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
+ //! @endinternal
+ //!
+ //! @par Complexity
+ //! Constant or linear.
+ iterator insert(iterator position, value_type const& value)
+ {
+ return this->priv_insert(position, value);
+ }
+
+ //! @pre
+ //! @li \c position must be a valid iterator of \c *this in range <tt>[begin(), end()]</tt>.
+ //! @li <tt>size() < capacity()</tt>
+ //!
+ //! @brief Inserts a move-constructed element at position.
+ //!
+ //! @param position The position at which the new value will be inserted.
+ //! @param value The value used to move construct the new element.
+ //!
+ //! @par Throws
+ //! If Value's move constructor or move assignment throws.
+ //! @internal
+ //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
+ //! @endinternal
+ //!
+ //! @par Complexity
+ //! Constant or linear.
+ iterator insert(iterator position, BOOST_RV_REF(value_type) value)
+ {
+ return this->priv_insert(position, value);
+ }
+
+ //! @pre
+ //! @li \c position must be a valid iterator of \c *this in range <tt>[begin(), end()]</tt>.
+ //! @li <tt>size() + count <= capacity()</tt>
+ //!
+ //! @brief Inserts a count copies of value at position.
+ //!
+ //! @param position The position at which new elements will be inserted.
+ //! @param count The number of new elements which will be inserted.
+ //! @param value The value used to copy construct new elements.
+ //!
+ //! @par Throws
+ //! @li If Value's copy constructor or copy assignment throws.
+ //! @li If Value's move constructor or move assignment throws.
+ //! @internal
+ //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
+ //! @endinternal
+ //!
+ //! @par Complexity
+ //! Linear O(N).
+ iterator insert(iterator position, size_type count, value_type const& value)
+ {
+ errh::check_iterator_end_eq(*this, position);
+ errh::check_capacity(*this, m_size + count); // may throw
+
+ if ( position == this->end() )
+ {
+ std::uninitialized_fill(position, position + count, value); // may throw
+ m_size += count; // update end
+ }
+ else
+ {
+ namespace sv = varray_detail;
+
+ difference_type to_move = std::distance(position, this->end());
+
+ // TODO - should following lines check for exception and revert to the old size?
+
+ if ( count < static_cast<size_type>(to_move) )
+ {
+ sv::uninitialized_move(this->end() - count, this->end(), this->end()); // may throw
+ m_size += count; // update end
+ sv::move_backward(position, position + to_move - count, this->end() - count); // may throw
+ std::fill_n(position, count, value); // may throw
+ }
+ else
+ {
+ std::uninitialized_fill(this->end(), position + count, value); // may throw
+ m_size += count - to_move; // update end
+ sv::uninitialized_move(position, position + to_move, position + count); // may throw
+ m_size += to_move; // update end
+ std::fill_n(position, to_move, value); // may throw
+ }
+ }
+
+ return position;
+ }
+
+ //! @pre
+ //! @li \c position must be a valid iterator of \c *this in range <tt>[begin(), end()]</tt>.
+ //! @li <tt>distance(first, last) <= capacity()</tt>
+ //! @li \c Iterator must meet the \c ForwardTraversalIterator concept.
+ //!
+ //! @brief Inserts a copy of a range <tt>[first, last)</tt> at position.
+ //!
+ //! @param position The position at which new elements will be inserted.
+ //! @param first The iterator to the first element of a range used to construct new elements.
+ //! @param last The iterator to the one after the last element of a range used to construct new elements.
+ //!
+ //! @par Throws
+ //! @li If Value's constructor and assignment taking a dereferenced \c Iterator.
+ //! @li If Value's move constructor or move assignment throws.
+ //! @internal
+ //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
+ //! @endinternal
+ //!
+ //! @par Complexity
+ //! Linear O(N).
+ template <typename Iterator>
+ iterator insert(iterator position, Iterator first, Iterator last)
+ {
+ BOOST_CONCEPT_ASSERT((boost_concepts::ForwardTraversal<Iterator>)); // Make sure you passed a ForwardIterator
+
+ typedef typename boost::iterator_traversal<Iterator>::type traversal;
+ this->insert_dispatch(position, first, last, traversal());
+
+ return position;
+ }
+
+ //! @pre \c position must be a valid iterator of \c *this in range <tt>[begin(), end())</tt>
+ //!
+ //! @brief Erases Value from position.
+ //!
+ //! @param position The position of the element which will be erased from the container.
+ //!
+ //! @par Throws
+ //! If Value's move assignment throws.
+ //!
+ //! @par Complexity
+ //! Linear O(N).
+ iterator erase(iterator position)
+ {
+ namespace sv = varray_detail;
+
+ errh::check_iterator_end_neq(*this, position);
+
+ //TODO - add empty check?
+ //errh::check_empty(*this);
+
+ sv::move(position + 1, this->end(), position); // may throw
+ sv::destroy(this->end() - 1);
+ --m_size;
+
+ return position;
+ }
+
+ //! @pre
+ //! @li \c first and \c last must define a valid range
+ //! @li iterators must be in range <tt>[begin(), end()]</tt>
+ //!
+ //! @brief Erases Values from a range <tt>[first, last)</tt>.
+ //!
+ //! @param first The position of the first element of a range which will be erased from the container.
+ //! @param last The position of the one after the last element of a range which will be erased from the container.
+ //!
+ //! @par Throws
+ //! If Value's move assignment throws.
+ //!
+ //! @par Complexity
+ //! Linear O(N).
+ iterator erase(iterator first, iterator last)
+ {
+ namespace sv = varray_detail;
+
+ errh::check_iterator_end_eq(*this, first);
+ errh::check_iterator_end_eq(*this, last);
+
+ difference_type n = std::distance(first, last);
+
+ //TODO - add invalid range check?
+ //BOOST_ASSERT_MSG(0 <= n, "invalid range");
+ //TODO - add this->size() check?
+ //BOOST_ASSERT_MSG(n <= this->size(), "invalid range");
+
+ sv::move(last, this->end(), first); // may throw
+ sv::destroy(this->end() - n, this->end());
+ m_size -= n;
+
+ return first;
+ }
+
+ //! @pre <tt>distance(first, last) <= capacity()</tt>
+ //!
+ //! @brief Assigns a range <tt>[first, last)</tt> of Values to this container.
+ //!
+ //! @param first The iterator to the first element of a range used to construct new content of this container.
+ //! @param last The iterator to the one after the last element of a range used to construct new content of this container.
+ //!
+ //! @par Throws
+ //! If Value's copy constructor or copy assignment throws,
+ //!
+ //! @par Complexity
+ //! Linear O(N).
+ template <typename Iterator>
+ void assign(Iterator first, Iterator last)
+ {
+ BOOST_CONCEPT_ASSERT((boost_concepts::ForwardTraversal<Iterator>)); // Make sure you passed a ForwardIterator
+
+ typedef typename boost::iterator_traversal<Iterator>::type traversal;
+ this->assign_dispatch(first, last, traversal()); // may throw
+ }
+
+ //! @pre <tt>count <= capacity()</tt>
+ //!
+ //! @brief Assigns a count copies of value to this container.
+ //!
+ //! @param count The new number of elements which will be container in the container.
+ //! @param value The value which will be used to copy construct the new content.
+ //!
+ //! @par Throws
+ //! If Value's copy constructor or copy assignment throws.
+ //!
+ //! @par Complexity
+ //! Linear O(N).
+ void assign(size_type count, value_type const& value)
+ {
+ if ( count < m_size )
+ {
+ namespace sv = varray_detail;
+
+ std::fill_n(this->begin(), count, value);
+ sv::destroy(this->begin() + count, this->end());
+ }
+ else
+ {
+ errh::check_capacity(*this, count); // may throw
+
+ std::fill_n(this->begin(), m_size, value);
+ std::uninitialized_fill(this->end(), this->begin() + count, value); // may throw
+ }
+ m_size = count; // update end
+ }
+
+#if !defined(BOOST_CONTAINER_VARRAY_DISABLE_EMPLACE)
+#if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ //! @pre <tt>size() < capacity()</tt>
+ //!
+ //! @brief Inserts a Value constructed with
+ //! \c std::forward<Args>(args)... in the end of the container.
+ //!
+ //! @param args The arguments of the constructor of the new element which will be created at the end of the container.
+ //!
+ //! @par Throws
+ //! If in-place constructor throws or Value's move constructor throws.
+ //! @internal
+ //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
+ //! @endinternal
+ //!
+ //! @par Complexity
+ //! Constant O(1).
+ template<class ...Args>
+ void emplace_back(Args &&...args)
+ {
+ errh::check_capacity(*this, m_size + 1); // may throw
+
+ namespace sv = varray_detail;
+ sv::construct(this->end(), ::boost::forward<Args>(args)...); // may throw
+ ++m_size; // update end
+ }
+
+ //! @pre
+ //! @li \c position must be a valid iterator of \c *this in range <tt>[begin(), end()]</tt>
+ //! @li <tt>size() < capacity()</tt>
+ //!
+ //! @brief Inserts a Value constructed with
+ //! \c std::forward<Args>(args)... before position
+ //!
+ //! @param position The position at which new elements will be inserted.
+ //! @param args The arguments of the constructor of the new element.
+ //!
+ //! @par Throws
+ //! If in-place constructor throws or if Value's move constructor or move assignment throws.
+ //! @internal
+ //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
+ //! @endinternal
+ //!
+ //! @par Complexity
+ //! Constant or linear.
+ template<class ...Args>
+ iterator emplace(iterator position, Args &&...args)
+ {
+ namespace sv = varray_detail;
+
+ errh::check_iterator_end_eq(*this, position);
+ errh::check_capacity(*this, m_size + 1); // may throw
+
+ if ( position == this->end() )
+ {
+ sv::construct(position, ::boost::forward<Args>(args)...); // may throw
+ ++m_size; // update end
+ }
+ else
+ {
+ // TODO - should following lines check for exception and revert to the old size?
+
+ // TODO - should move be used only if it's nonthrowing?
+ value_type & r = *(this->end() - 1);
+ sv::construct(this->end(), boost::move(r)); // may throw
+ ++m_size; // update end
+ sv::move_backward(position, this->end() - 2, this->end() - 1); // may throw
+
+ aligned_storage<sizeof(value_type), alignment_of<value_type>::value> temp_storage;
+ value_type * val_p = static_cast<value_type *>(temp_storage.address());
+ sv::construct(val_p, ::boost::forward<Args>(args)...); // may throw
+ sv::scoped_destructor<value_type> d(val_p);
+ sv::assign(position, ::boost::move(*val_p)); // may throw
+ }
+
+ return position;
+ }
+
+#else // BOOST_CONTAINER_PERFECT_FORWARDING || BOOST_CONTAINER_DOXYGEN_INVOKED
+
+ #define BOOST_PP_LOCAL_MACRO(n) \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ void emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
+ { \
+ errh::check_capacity(*this, m_size + 1); /*may throw*/\
+ \
+ namespace sv = varray_detail; \
+ sv::construct(this->end() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ); /*may throw*/\
+ ++m_size; /*update end*/ \
+ } \
+ //
+ #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
+ #include BOOST_PP_LOCAL_ITERATE()
+
+ #define BOOST_PP_LOCAL_MACRO(n) \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ iterator emplace(iterator position BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
+ { \
+ namespace sv = varray_detail; \
+ \
+ errh::check_iterator_end_eq(*this, position); \
+ errh::check_capacity(*this, m_size + 1); /*may throw*/\
+ \
+ if ( position == this->end() ) \
+ { \
+ sv::construct(position BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ); /*may throw*/\
+ ++m_size; /*update end*/ \
+ } \
+ else \
+ { \
+ /* TODO - should following lines check for exception and revert to the old size? */ \
+ /* TODO - should move be used only if it's nonthrowing? */ \
+ \
+ value_type & r = *(this->end() - 1); \
+ sv::construct(this->end(), boost::move(r)); /*may throw*/\
+ ++m_size; /*update end*/ \
+ sv::move_backward(position, this->end() - 2, this->end() - 1); /*may throw*/\
+ \
+ aligned_storage<sizeof(value_type), alignment_of<value_type>::value> temp_storage; \
+ value_type * val_p = static_cast<value_type *>(temp_storage.address()); \
+ sv::construct(val_p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ); /*may throw*/\
+ sv::scoped_destructor<value_type> d(val_p); \
+ sv::assign(position, ::boost::move(*val_p)); /*may throw*/\
+ } \
+ \
+ return position; \
+ } \
+ //
+ #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
+ #include BOOST_PP_LOCAL_ITERATE()
+
+#endif // BOOST_CONTAINER_PERFECT_FORWARDING || BOOST_CONTAINER_DOXYGEN_INVOKED
+#endif // !BOOST_CONTAINER_VARRAY_DISABLE_EMPLACE
+
+ //! @brief Removes all elements from the container.
+ //!
+ //! @par Throws
+ //! Nothing.
+ //!
+ //! @par Complexity
+ //! Constant O(1).
+ void clear()
+ {
+ namespace sv = varray_detail;
+ sv::destroy(this->begin(), this->end());
+ m_size = 0; // update end
+ }
+
+ //! @pre <tt>i < size()</tt>
+ //!
+ //! @brief Returns reference to the i-th element.
+ //!
+ //! @param i The element's index.
+ //!
+ //! @return reference to the i-th element
+ //! from the beginning of the container.
+ //!
+ //! @par Throws
+ //! \c std::out_of_range exception by default.
+ //!
+ //! @par Complexity
+ //! Constant O(1).
+ reference at(size_type i)
+ {
+ errh::check_at(*this, i); // may throw
+ return *(this->begin() + i);
+ }
+
+ //! @pre <tt>i < size()</tt>
+ //!
+ //! @brief Returns const reference to the i-th element.
+ //!
+ //! @param i The element's index.
+ //!
+ //! @return const reference to the i-th element
+ //! from the beginning of the container.
+ //!
+ //! @par Throws
+ //! \c std::out_of_range exception by default.
+ //!
+ //! @par Complexity
+ //! Constant O(1).
+ const_reference at(size_type i) const
+ {
+ errh::check_at(*this, i); // may throw
+ return *(this->begin() + i);
+ }
+
+ //! @pre <tt>i < size()</tt>
+ //!
+ //! @brief Returns reference to the i-th element.
+ //!
+ //! @param i The element's index.
+ //!
+ //! @return reference to the i-th element
+ //! from the beginning of the container.
+ //!
+ //! @par Throws
+ //! Nothing by default.
+ //!
+ //! @par Complexity
+ //! Constant O(1).
+ reference operator[](size_type i)
+ {
+ // TODO: Remove bounds check? std::vector and std::array operator[] don't check.
+ errh::check_operator_brackets(*this, i);
+ return *(this->begin() + i);
+ }
+
+ //! @pre <tt>i < size()</tt>
+ //!
+ //! @brief Returns const reference to the i-th element.
+ //!
+ //! @param i The element's index.
+ //!
+ //! @return const reference to the i-th element
+ //! from the beginning of the container.
+ //!
+ //! @par Throws
+ //! Nothing by default.
+ //!
+ //! @par Complexity
+ //! Constant O(1).
+ const_reference operator[](size_type i) const
+ {
+ errh::check_operator_brackets(*this, i);
+ return *(this->begin() + i);
+ }
+
+ //! @pre \c !empty()
+ //!
+ //! @brief Returns reference to the first element.
+ //!
+ //! @return reference to the first element
+ //! from the beginning of the container.
+ //!
+ //! @par Throws
+ //! Nothing by default.
+ //!
+ //! @par Complexity
+ //! Constant O(1).
+ reference front()
+ {
+ errh::check_empty(*this);
+ return *(this->begin());
+ }
+
+ //! @pre \c !empty()
+ //!
+ //! @brief Returns const reference to the first element.
+ //!
+ //! @return const reference to the first element
+ //! from the beginning of the container.
+ //!
+ //! @par Throws
+ //! Nothing by default.
+ //!
+ //! @par Complexity
+ //! Constant O(1).
+ const_reference front() const
+ {
+ errh::check_empty(*this);
+ return *(this->begin());
+ }
+
+ //! @pre \c !empty()
+ //!
+ //! @brief Returns reference to the last element.
+ //!
+ //! @return reference to the last element
+ //! from the beginning of the container.
+ //!
+ //! @par Throws
+ //! Nothing by default.
+ //!
+ //! @par Complexity
+ //! Constant O(1).
+ reference back()
+ {
+ errh::check_empty(*this);
+ return *(this->end() - 1);
+ }
+
+ //! @pre \c !empty()
+ //!
+ //! @brief Returns const reference to the first element.
+ //!
+ //! @return const reference to the last element
+ //! from the beginning of the container.
+ //!
+ //! @par Throws
+ //! Nothing by default.
+ //!
+ //! @par Complexity
+ //! Constant O(1).
+ const_reference back() const
+ {
+ errh::check_empty(*this);
+ return *(this->end() - 1);
+ }
+
+ //! @brief Pointer such that <tt>[data(), data() + size())</tt> is a valid range.
+ //! For a non-empty vector <tt>data() == &front()</tt>.
+ //!
+ //! @par Throws
+ //! Nothing.
+ //!
+ //! @par Complexity
+ //! Constant O(1).
+ Value * data()
+ {
+ return boost::addressof(*(this->ptr()));
+ }
+
+ //! @brief Const pointer such that <tt>[data(), data() + size())</tt> is a valid range.
+ //! For a non-empty vector <tt>data() == &front()</tt>.
+ //!
+ //! @par Throws
+ //! Nothing.
+ //!
+ //! @par Complexity
+ //! Constant O(1).
+ const Value * data() const
+ {
+ return boost::addressof(*(this->ptr()));
+ }
+
+
+ //! @brief Returns iterator to the first element.
+ //!
+ //! @return iterator to the first element contained in the vector.
+ //!
+ //! @par Throws
+ //! Nothing.
+ //!
+ //! @par Complexity
+ //! Constant O(1).
+ iterator begin() { return this->ptr(); }
+
+ //! @brief Returns const iterator to the first element.
+ //!
+ //! @return const_iterator to the first element contained in the vector.
+ //!
+ //! @par Throws
+ //! Nothing.
+ //!
+ //! @par Complexity
+ //! Constant O(1).
+ const_iterator begin() const { return this->ptr(); }
+
+ //! @brief Returns const iterator to the first element.
+ //!
+ //! @return const_iterator to the first element contained in the vector.
+ //!
+ //! @par Throws
+ //! Nothing.
+ //!
+ //! @par Complexity
+ //! Constant O(1).
+ const_iterator cbegin() const { return this->ptr(); }
+
+ //! @brief Returns iterator to the one after the last element.
+ //!
+ //! @return iterator pointing to the one after the last element contained in the vector.
+ //!
+ //! @par Throws
+ //! Nothing.
+ //!
+ //! @par Complexity
+ //! Constant O(1).
+ iterator end() { return this->begin() + m_size; }
+
+ //! @brief Returns const iterator to the one after the last element.
+ //!
+ //! @return const_iterator pointing to the one after the last element contained in the vector.
+ //!
+ //! @par Throws
+ //! Nothing.
+ //!
+ //! @par Complexity
+ //! Constant O(1).
+ const_iterator end() const { return this->begin() + m_size; }
+
+ //! @brief Returns const iterator to the one after the last element.
+ //!
+ //! @return const_iterator pointing to the one after the last element contained in the vector.
+ //!
+ //! @par Throws
+ //! Nothing.
+ //!
+ //! @par Complexity
+ //! Constant O(1).
+ const_iterator cend() const { return this->cbegin() + m_size; }
+
+ //! @brief Returns reverse iterator to the first element of the reversed container.
+ //!
+ //! @return reverse_iterator pointing to the beginning
+ //! of the reversed varray.
+ //!
+ //! @par Throws
+ //! Nothing.
+ //!
+ //! @par Complexity
+ //! Constant O(1).
+ reverse_iterator rbegin() { return reverse_iterator(this->end()); }
+
+ //! @brief Returns const reverse iterator to the first element of the reversed container.
+ //!
+ //! @return const_reverse_iterator pointing to the beginning
+ //! of the reversed varray.
+ //!
+ //! @par Throws
+ //! Nothing.
+ //!
+ //! @par Complexity
+ //! Constant O(1).
+ const_reverse_iterator rbegin() const { return reverse_iterator(this->end()); }
+
+ //! @brief Returns const reverse iterator to the first element of the reversed container.
+ //!
+ //! @return const_reverse_iterator pointing to the beginning
+ //! of the reversed varray.
+ //!
+ //! @par Throws
+ //! Nothing.
+ //!
+ //! @par Complexity
+ //! Constant O(1).
+ const_reverse_iterator crbegin() const { return reverse_iterator(this->end()); }
+
+ //! @brief Returns reverse iterator to the one after the last element of the reversed container.
+ //!
+ //! @return reverse_iterator pointing to the one after the last element
+ //! of the reversed varray.
+ //!
+ //! @par Throws
+ //! Nothing.
+ //!
+ //! @par Complexity
+ //! Constant O(1).
+ reverse_iterator rend() { return reverse_iterator(this->begin()); }
+
+ //! @brief Returns const reverse iterator to the one after the last element of the reversed container.
+ //!
+ //! @return const_reverse_iterator pointing to the one after the last element
+ //! of the reversed varray.
+ //!
+ //! @par Throws
+ //! Nothing.
+ //!
+ //! @par Complexity
+ //! Constant O(1).
+ const_reverse_iterator rend() const { return reverse_iterator(this->begin()); }
+
+ //! @brief Returns const reverse iterator to the one after the last element of the reversed container.
+ //!
+ //! @return const_reverse_iterator pointing to the one after the last element
+ //! of the reversed varray.
+ //!
+ //! @par Throws
+ //! Nothing.
+ //!
+ //! @par Complexity
+ //! Constant O(1).
+ const_reverse_iterator crend() const { return reverse_iterator(this->begin()); }
+
+ //! @brief Returns container's capacity.
+ //!
+ //! @return container's capacity.
+ //!
+ //! @par Throws
+ //! Nothing.
+ //!
+ //! @par Complexity
+ //! Constant O(1).
+ static size_type capacity() { return Capacity; }
+
+ //! @brief Returns container's capacity.
+ //!
+ //! @return container's capacity.
+ //!
+ //! @par Throws
+ //! Nothing.
+ //!
+ //! @par Complexity
+ //! Constant O(1).
+ static size_type max_size() { return Capacity; }
+
+ //! @brief Returns the number of stored elements.
+ //!
+ //! @return Number of elements contained in the container.
+ //!
+ //! @par Throws
+ //! Nothing.
+ //!
+ //! @par Complexity
+ //! Constant O(1).
+ size_type size() const { return m_size; }
+
+ //! @brief Queries if the container contains elements.
+ //!
+ //! @return true if the number of elements contained in the
+ //! container is equal to 0.
+ //!
+ //! @par Throws
+ //! Nothing.
+ //!
+ //! @par Complexity
+ //! Constant O(1).
+ bool empty() const { return 0 == m_size; }
+
+ //! @brief Capacity is fixed so this call has no effects.
+ //!
+ //! @par Throws
+ //! Nothing.
+ //!
+ //! @par Complexity
+ //! Constant O(1).
+ void shrink_to_fit() {}
+
+private:
+
+ // @par Throws
+ // Nothing.
+ // @par Complexity
+ // Linear O(N).
+ template <std::size_t C, typename S>
+ void move_ctor_dispatch(varray<value_type, C, S> & other, boost::true_type /*use_memop*/)
+ {
+ ::memcpy(this->data(), other.data(), sizeof(Value) * other.m_size);
+ m_size = other.m_size;
+ other.m_size = 0;
+ }
+
+ // @par Throws
+ // @li If boost::has_nothrow_move<Value>::value is true and Value's move constructor throws
+ // @li If boost::has_nothrow_move<Value>::value is false and Value's copy constructor throws.
+ // @par Complexity
+ // Linear O(N).
+ template <std::size_t C, typename S>
+ void move_ctor_dispatch(varray<value_type, C, S> & other, boost::false_type /*use_memop*/)
+ {
+ namespace sv = varray_detail;
+ sv::uninitialized_move_if_noexcept(other.begin(), other.end(), this->begin()); // may throw
+ m_size = other.m_size;
+ sv::destroy(other.begin(), other.end());
+ other.m_size = 0;
+ }
+
+ // @par Throws
+ // Nothing.
+ // @par Complexity
+ // Linear O(N).
+ template <std::size_t C, typename S>
+ void move_assign_dispatch(varray<value_type, C, S> & other, boost::true_type /*use_memop*/)
+ {
+ this->clear();
+
+ ::memcpy(this->data(), other.data(), sizeof(Value) * other.m_size);
+ boost::swap(m_size, other.m_size);
+ }
+
+ // @par Throws
+ // @li If boost::has_nothrow_move<Value>::value is true and Value's move constructor or move assignment throws
+ // @li If boost::has_nothrow_move<Value>::value is false and Value's copy constructor or move assignment throws.
+ // @par Complexity
+ // Linear O(N).
+ template <std::size_t C, typename S>
+ void move_assign_dispatch(varray<value_type, C, S> & other, boost::false_type /*use_memop*/)
+ {
+ namespace sv = varray_detail;
+ if ( m_size <= static_cast<size_type>(other.size()) )
+ {
+ sv::move_if_noexcept(other.begin(), other.begin() + m_size, this->begin()); // may throw
+ // TODO - perform uninitialized_copy first?
+ sv::uninitialized_move_if_noexcept(other.begin() + m_size, other.end(), this->end()); // may throw
+ }
+ else
+ {
+ sv::move_if_noexcept(other.begin(), other.end(), this->begin()); // may throw
+ sv::destroy(this->begin() + other.size(), this->end());
+ }
+ m_size = other.size(); // update end
+
+ other.clear();
+ }
+
+ // @par Throws
+ // Nothing.
+ // @par Complexity
+ // Linear O(N).
+ template <std::size_t C, typename S>
+ void swap_dispatch(varray<value_type, C, S> & other, boost::true_type const& /*use_optimized_swap*/)
+ {
+ typedef typename
+ boost::mpl::if_c<
+ Capacity < C,
+ aligned_storage_type,
+ typename varray<value_type, C, S>::aligned_storage_type
+ >::type
+ storage_type;
+
+ storage_type temp;
+ Value * temp_ptr = reinterpret_cast<Value*>(temp.address());
+
+ ::memcpy(temp_ptr, this->data(), sizeof(Value) * this->size());
+ ::memcpy(this->data(), other.data(), sizeof(Value) * other.size());
+ ::memcpy(other.data(), temp_ptr, sizeof(Value) * this->size());
+
+ boost::swap(m_size, other.m_size);
+ }
+
+ // @par Throws
+ // If Value's move constructor or move assignment throws
+ // but only if use_memop_in_swap_and_move is false_type - default.
+ // @par Complexity
+ // Linear O(N).
+ template <std::size_t C, typename S>
+ void swap_dispatch(varray<value_type, C, S> & other, boost::false_type const& /*use_optimized_swap*/)
+ {
+ namespace sv = varray_detail;
+
+ typedef typename
+ vt::use_memop_in_swap_and_move use_memop_in_swap_and_move;
+
+ if ( this->size() < other.size() )
+ swap_dispatch_impl(this->begin(), this->end(), other.begin(), other.end(), use_memop_in_swap_and_move()); // may throw
+ else
+ swap_dispatch_impl(other.begin(), other.end(), this->begin(), this->end(), use_memop_in_swap_and_move()); // may throw
+ boost::swap(m_size, other.m_size);
+ }
+
+ // @par Throws
+ // Nothing.
+ // @par Complexity
+ // Linear O(N).
+ void swap_dispatch_impl(iterator first_sm, iterator last_sm, iterator first_la, iterator last_la, boost::true_type const& /*use_memop*/)
+ {
+ //BOOST_ASSERT_MSG(std::distance(first_sm, last_sm) <= std::distance(first_la, last_la));
+
+ namespace sv = varray_detail;
+ for (; first_sm != last_sm ; ++first_sm, ++first_la)
+ {
+ boost::aligned_storage<
+ sizeof(value_type),
+ boost::alignment_of<value_type>::value
+ > temp_storage;
+ value_type * temp_ptr = reinterpret_cast<value_type*>(temp_storage.address());
+
+ ::memcpy(temp_ptr, boost::addressof(*first_sm), sizeof(value_type));
+ ::memcpy(boost::addressof(*first_sm), boost::addressof(*first_la), sizeof(value_type));
+ ::memcpy(boost::addressof(*first_la), temp_ptr, sizeof(value_type));
+ }
+
+ ::memcpy(first_sm, first_la, sizeof(value_type) * std::distance(first_la, last_la));
+ }
+
+ // @par Throws
+ // If Value's move constructor or move assignment throws.
+ // @par Complexity
+ // Linear O(N).
+ void swap_dispatch_impl(iterator first_sm, iterator last_sm, iterator first_la, iterator last_la, boost::false_type const& /*use_memop*/)
+ {
+ //BOOST_ASSERT_MSG(std::distance(first_sm, last_sm) <= std::distance(first_la, last_la));
+
+ namespace sv = varray_detail;
+ for (; first_sm != last_sm ; ++first_sm, ++first_la)
+ {
+ //boost::swap(*first_sm, *first_la); // may throw
+ value_type temp(boost::move(*first_sm)); // may throw
+ *first_sm = boost::move(*first_la); // may throw
+ *first_la = boost::move(temp); // may throw
+ }
+ sv::uninitialized_move(first_la, last_la, first_sm); // may throw
+ sv::destroy(first_la, last_la);
+ }
+
+ // insert
+
+ // @par Throws
+ // If Value's move constructor or move assignment throws
+ // or if Value's copy assignment throws.
+ // @par Complexity
+ // Linear O(N).
+ template <typename V>
+ iterator priv_insert(iterator position, V & value)
+ {
+ namespace sv = varray_detail;
+
+ errh::check_iterator_end_eq(*this, position);
+ errh::check_capacity(*this, m_size + 1); // may throw
+
+ if ( position == this->end() )
+ {
+ sv::construct(position, value); // may throw
+ ++m_size; // update end
+ }
+ else
+ {
+ // TODO - should following lines check for exception and revert to the old size?
+
+ // TODO - should move be used only if it's nonthrowing?
+ value_type & r = *(this->end() - 1);
+ sv::construct(this->end(), boost::move(r)); // may throw
+ ++m_size; // update end
+ sv::move_backward(position, this->end() - 2, this->end() - 1); // may throw
+ sv::assign(position, value); // may throw
+ }
+
+ return position;
+ }
+
+ // insert
+
+ // @par Throws
+ // If Value's move constructor, move assignment throws
+ // or if Value's copy constructor or copy assignment throws.
+ // @par Complexity
+ // Linear O(N).
+ template <typename Iterator>
+ void insert_dispatch(iterator position, Iterator first, Iterator last, boost::random_access_traversal_tag const&)
+ {
+ BOOST_CONCEPT_ASSERT((boost_concepts::RandomAccessTraversal<Iterator>)); // Make sure you passed a RandomAccessIterator
+
+ errh::check_iterator_end_eq(*this, position);
+
+ typename boost::iterator_difference<Iterator>::type
+ count = std::distance(first, last);
+
+ errh::check_capacity(*this, m_size + count); // may throw
+
+ if ( position == this->end() )
+ {
+ namespace sv = varray_detail;
+
+ sv::uninitialized_copy(first, last, position); // may throw
+ m_size += count; // update end
+ }
+ else
+ {
+ this->insert_in_the_middle(position, first, last, count); // may throw
+ }
+ }
+
+ // @par Throws
+ // If Value's move constructor, move assignment throws
+ // or if Value's copy constructor or copy assignment throws.
+ // @par Complexity
+ // Linear O(N).
+ template <typename Iterator, typename Traversal>
+ void insert_dispatch(iterator position, Iterator first, Iterator last, Traversal const& /*not_random_access*/)
+ {
+ errh::check_iterator_end_eq(*this, position);
+
+ if ( position == this->end() )
+ {
+ namespace sv = varray_detail;
+
+ std::ptrdiff_t d = std::distance(position, this->begin() + Capacity);
+ std::size_t count = sv::uninitialized_copy_s(first, last, position, d); // may throw
+
+ errh::check_capacity(*this, count <= static_cast<std::size_t>(d) ? m_size + count : Capacity + 1); // may throw
+
+ m_size += count;
+ }
+ else
+ {
+ typename boost::iterator_difference<Iterator>::type
+ count = std::distance(first, last);
+
+ errh::check_capacity(*this, m_size + count); // may throw
+
+ this->insert_in_the_middle(position, first, last, count); // may throw
+ }
+ }
+
+ // @par Throws
+ // If Value's move constructor, move assignment throws
+ // or if Value's copy constructor or copy assignment throws.
+ // @par Complexity
+ // Linear O(N).
+ template <typename Iterator>
+ void insert_in_the_middle(iterator position, Iterator first, Iterator last, difference_type count)
+ {
+ namespace sv = varray_detail;
+
+ difference_type to_move = std::distance(position, this->end());
+
+ // TODO - should following lines check for exception and revert to the old size?
+
+ if ( count < to_move )
+ {
+ sv::uninitialized_move(this->end() - count, this->end(), this->end()); // may throw
+ m_size += count; // update end
+ sv::move_backward(position, position + to_move - count, this->end() - count); // may throw
+ sv::copy(first, last, position); // may throw
+ }
+ else
+ {
+ Iterator middle_iter = first;
+ std::advance(middle_iter, to_move);
+
+ sv::uninitialized_copy(middle_iter, last, this->end()); // may throw
+ m_size += count - to_move; // update end
+ sv::uninitialized_move(position, position + to_move, position + count); // may throw
+ m_size += to_move; // update end
+ sv::copy(first, middle_iter, position); // may throw
+ }
+ }
+
+ // assign
+
+ // @par Throws
+ // If Value's constructor or assignment taking dereferenced Iterator throws.
+ // @par Complexity
+ // Linear O(N).
+ template <typename Iterator>
+ void assign_dispatch(Iterator first, Iterator last, boost::random_access_traversal_tag const& /*not_random_access*/)
+ {
+ namespace sv = varray_detail;
+
+ typename boost::iterator_difference<Iterator>::type
+ s = std::distance(first, last);
+
+ errh::check_capacity(*this, s); // may throw
+
+ if ( m_size <= static_cast<size_type>(s) )
+ {
+ sv::copy(first, first + m_size, this->begin()); // may throw
+ // TODO - perform uninitialized_copy first?
+ sv::uninitialized_copy(first + m_size, last, this->end()); // may throw
+ }
+ else
+ {
+ sv::copy(first, last, this->begin()); // may throw
+ sv::destroy(this->begin() + s, this->end());
+ }
+ m_size = s; // update end
+ }
+
+ // @par Throws
+ // If Value's constructor or assignment taking dereferenced Iterator throws.
+ // @par Complexity
+ // Linear O(N).
+ template <typename Iterator, typename Traversal>
+ void assign_dispatch(Iterator first, Iterator last, Traversal const& /*not_random_access*/)
+ {
+ namespace sv = varray_detail;
+
+ size_type s = 0;
+ iterator it = this->begin();
+
+ for ( ; it != this->end() && first != last ; ++it, ++first, ++s )
+ *it = *first; // may throw
+
+ sv::destroy(it, this->end());
+
+ std::ptrdiff_t d = std::distance(it, this->begin() + Capacity);
+ std::size_t count = sv::uninitialized_copy_s(first, last, it, d); // may throw
+ s += count;
+
+ errh::check_capacity(*this, count <= static_cast<std::size_t>(d) ? s : Capacity + 1); // may throw
+
+ m_size = s; // update end
+ }
+
+ pointer ptr()
+ {
+ return pointer(static_cast<Value*>(m_storage.address()));
+ }
+
+ const_pointer ptr() const
+ {
+ return const_pointer(static_cast<const Value*>(m_storage.address()));
+ }
+
+ size_type m_size;
+ aligned_storage_type m_storage;
+};
+
+#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+
+template<typename Value, typename Strategy>
+class varray<Value, 0, Strategy>
+{
+ typedef varray_traits<
+ Value, 0, Strategy
+ > vt;
+
+ typedef typename vt::size_type stored_size_type;
+ typedef typename vt::error_handler errh;
+
+public:
+ typedef typename vt::value_type value_type;
+ typedef stored_size_type size_type;
+ typedef typename vt::difference_type difference_type;
+ typedef typename vt::pointer pointer;
+ typedef typename vt::const_pointer const_pointer;
+ typedef typename vt::reference reference;
+ typedef typename vt::const_reference const_reference;
+
+ typedef pointer iterator;
+ typedef const_pointer const_iterator;
+ typedef boost::reverse_iterator<iterator> reverse_iterator;
+ typedef boost::reverse_iterator<const_iterator> const_reverse_iterator;
+
+ // nothrow
+ varray() {}
+
+ // strong
+ explicit varray(size_type count)
+ {
+ errh::check_capacity(*this, count); // may throw
+ }
+
+ // strong
+ varray(size_type count, value_type const&)
+ {
+ errh::check_capacity(*this, count); // may throw
+ }
+
+ // strong
+ varray(varray const& other)
+ {
+ //errh::check_capacity(*this, count);
+ }
+
+ // strong
+ template <size_t C, typename S>
+ varray(varray<value_type, C, S> const& other)
+ {
+ errh::check_capacity(*this, other.size()); // may throw
+ }
+
+ // strong
+ template <typename Iterator>
+ varray(Iterator first, Iterator last)
+ {
+ errh::check_capacity(*this, std::distance(first, last)); // may throw
+ }
+
+ // basic
+ varray & operator=(varray const& other)
+ {
+ //errh::check_capacity(*this, other.size());
+ return *this;
+ }
+
+ // basic
+ template <size_t C, typename S>
+ varray & operator=(varray<value_type, C, S> const& other)
+ {
+ errh::check_capacity(*this, other.size()); // may throw
+ return *this;
+ }
+
+ // nothrow
+ ~varray() {}
+
+ // strong
+ void resize(size_type count)
+ {
+ errh::check_capacity(*this, count); // may throw
+ }
+
+ // strong
+ void resize(size_type count, value_type const&)
+ {
+ errh::check_capacity(*this, count); // may throw
+ }
+
+
+ // nothrow
+ void reserve(size_type count)
+ {
+ errh::check_capacity(*this, count); // may throw
+ }
+
+ // strong
+ void push_back(value_type const&)
+ {
+ errh::check_capacity(*this, 1); // may throw
+ }
+
+ // nothrow
+ void pop_back()
+ {
+ errh::check_empty(*this);
+ }
+
+ // basic
+ void insert(iterator position, value_type const&)
+ {
+ errh::check_iterator_end_eq(*this, position);
+ errh::check_capacity(*this, 1); // may throw
+ }
+
+ // basic
+ void insert(iterator position, size_type count, value_type const&)
+ {
+ errh::check_iterator_end_eq(*this, position);
+ errh::check_capacity(*this, count); // may throw
+ }
+
+ // basic
+ template <typename Iterator>
+ void insert(iterator, Iterator first, Iterator last)
+ {
+ // TODO - add MPL_ASSERT, check if Iterator is really an iterator
+ typedef typename boost::iterator_traversal<Iterator>::type traversal;
+ errh::check_capacity(*this, std::distance(first, last)); // may throw
+ }
+
+ // basic
+ void erase(iterator position)
+ {
+ errh::check_iterator_end_neq(*this, position);
+ }
+
+ // basic
+ void erase(iterator first, iterator last)
+ {
+ errh::check_iterator_end_eq(*this, first);
+ errh::check_iterator_end_eq(*this, last);
+
+ //BOOST_ASSERT_MSG(0 <= n, "invalid range");
+ }
+
+ // basic
+ template <typename Iterator>
+ void assign(Iterator first, Iterator last)
+ {
+ // TODO - add MPL_ASSERT, check if Iterator is really an iterator
+ typedef typename boost::iterator_traversal<Iterator>::type traversal;
+ errh::check_capacity(*this, std::distance(first, last)); // may throw
+ }
+
+ // basic
+ void assign(size_type count, value_type const&)
+ {
+ errh::check_capacity(*this, count); // may throw
+ }
+
+ // nothrow
+ void clear() {}
+
+ // strong
+ reference at(size_type i)
+ {
+ errh::check_at(*this, i); // may throw
+ return *(this->begin() + i);
+ }
+
+ // strong
+ const_reference at(size_type i) const
+ {
+ errh::check_at(*this, i); // may throw
+ return *(this->begin() + i);
+ }
+
+ // nothrow
+ reference operator[](size_type i)
+ {
+ errh::check_operator_brackets(*this, i);
+ return *(this->begin() + i);
+ }
+
+ // nothrow
+ const_reference operator[](size_type i) const
+ {
+ errh::check_operator_brackets(*this, i);
+ return *(this->begin() + i);
+ }
+
+ // nothrow
+ reference front()
+ {
+ errh::check_empty(*this);
+ return *(this->begin());
+ }
+
+ // nothrow
+ const_reference front() const
+ {
+ errh::check_empty(*this);
+ return *(this->begin());
+ }
+
+ // nothrow
+ reference back()
+ {
+ errh::check_empty(*this);
+ return *(this->end() - 1);
+ }
+
+ // nothrow
+ const_reference back() const
+ {
+ errh::check_empty(*this);
+ return *(this->end() - 1);
+ }
+
+ // nothrow
+ Value * data() { return boost::addressof(*(this->ptr())); }
+ const Value * data() const { return boost::addressof(*(this->ptr())); }
+
+ // nothrow
+ iterator begin() { return this->ptr(); }
+ const_iterator begin() const { return this->ptr(); }
+ const_iterator cbegin() const { return this->ptr(); }
+ iterator end() { return this->begin(); }
+ const_iterator end() const { return this->begin(); }
+ const_iterator cend() const { return this->cbegin(); }
+ // nothrow
+ reverse_iterator rbegin() { return reverse_iterator(this->end()); }
+ const_reverse_iterator rbegin() const { return reverse_iterator(this->end()); }
+ const_reverse_iterator crbegin() const { return reverse_iterator(this->end()); }
+ reverse_iterator rend() { return reverse_iterator(this->begin()); }
+ const_reverse_iterator rend() const { return reverse_iterator(this->begin()); }
+ const_reverse_iterator crend() const { return reverse_iterator(this->begin()); }
+
+ // nothrow
+ size_type capacity() const { return 0; }
+ size_type max_size() const { return 0; }
+ size_type size() const { return 0; }
+ bool empty() const { return true; }
+ void shrink_to_fit() {}
+
+private:
+
+ pointer ptr()
+ {
+ return pointer(reinterpret_cast<Value*>(this));
+ }
+
+ const_pointer ptr() const
+ {
+ return const_pointer(reinterpret_cast<const Value*>(this));
+ }
+};
+
+#endif // !BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION && !BOOST_CONTAINER_DOXYGEN_INVOKED
+
+//! @brief Checks if contents of two varrays are equal.
+//!
+//! @ingroup varray_non_member
+//!
+//! @param x The first varray.
+//! @param y The second varray.
+//!
+//! @return \c true if containers have the same size and elements in both containers are equal.
+//!
+//! @par Complexity
+//! Linear O(N).
+template<typename V, std::size_t C1, typename S1, std::size_t C2, typename S2>
+bool operator== (varray<V, C1, S1> const& x, varray<V, C2, S2> const& y)
+{
+ return x.size() == y.size() && std::equal(x.begin(), x.end(), y.begin());
+}
+
+//! @brief Checks if contents of two varrays are not equal.
+//!
+//! @ingroup varray_non_member
+//!
+//! @param x The first varray.
+//! @param y The second varray.
+//!
+//! @return \c true if containers have different size or elements in both containers are not equal.
+//!
+//! @par Complexity
+//! Linear O(N).
+template<typename V, std::size_t C1, typename S1, std::size_t C2, typename S2>
+bool operator!= (varray<V, C1, S1> const& x, varray<V, C2, S2> const& y)
+{
+ return !(x==y);
+}
+
+//! @brief Lexicographically compares varrays.
+//!
+//! @ingroup varray_non_member
+//!
+//! @param x The first varray.
+//! @param y The second varray.
+//!
+//! @return \c true if x compares lexicographically less than y.
+//!
+//! @par Complexity
+//! Linear O(N).
+template<typename V, std::size_t C1, typename S1, std::size_t C2, typename S2>
+bool operator< (varray<V, C1, S1> const& x, varray<V, C2, S2> const& y)
+{
+ return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end());
+}
+
+//! @brief Lexicographically compares varrays.
+//!
+//! @ingroup varray_non_member
+//!
+//! @param x The first varray.
+//! @param y The second varray.
+//!
+//! @return \c true if y compares lexicographically less than x.
+//!
+//! @par Complexity
+//! Linear O(N).
+template<typename V, std::size_t C1, typename S1, std::size_t C2, typename S2>
+bool operator> (varray<V, C1, S1> const& x, varray<V, C2, S2> const& y)
+{
+ return y<x;
+}
+
+//! @brief Lexicographically compares varrays.
+//!
+//! @ingroup varray_non_member
+//!
+//! @param x The first varray.
+//! @param y The second varray.
+//!
+//! @return \c true if y don't compare lexicographically less than x.
+//!
+//! @par Complexity
+//! Linear O(N).
+template<typename V, std::size_t C1, typename S1, std::size_t C2, typename S2>
+bool operator<= (varray<V, C1, S1> const& x, varray<V, C2, S2> const& y)
+{
+ return !(y<x);
+}
+
+//! @brief Lexicographically compares varrays.
+//!
+//! @ingroup varray_non_member
+//!
+//! @param x The first varray.
+//! @param y The second varray.
+//!
+//! @return \c true if x don't compare lexicographically less than y.
+//!
+//! @par Complexity
+//! Linear O(N).
+template<typename V, std::size_t C1, typename S1, std::size_t C2, typename S2>
+bool operator>= (varray<V, C1, S1> const& x, varray<V, C2, S2> const& y)
+{
+ return !(x<y);
+}
+
+//! @brief Swaps contents of two varrays.
+//!
+//! This function calls varray::swap().
+//!
+//! @ingroup varray_non_member
+//!
+//! @param x The first varray.
+//! @param y The second varray.
+//!
+//! @par Complexity
+//! Linear O(N).
+template<typename V, std::size_t C1, typename S1, std::size_t C2, typename S2>
+inline void swap(varray<V, C1, S1> & x, varray<V, C2, S2> & y)
+{
+ x.swap(y);
+}
+
+}}} // namespace boost::container::container_detail
+
+#include <boost/container/detail/config_end.hpp>
+
+#endif // BOOST_CONTAINER_DETAIL_VARRAY_HPP

Copied: sandbox/varray/boost/container/detail/varray_concept.hpp (from r82619, /sandbox/varray/boost/container/detail/static_vector_concept.hpp)
==============================================================================
--- /sandbox/varray/boost/container/detail/static_vector_concept.hpp (original)
+++ sandbox/varray/boost/container/detail/varray_concept.hpp 2013-01-26 22:36:10 EST (Sat, 26 Jan 2013)
@@ -1,27 +1,27 @@
-// Boost.Container StaticVector
+// Boost.Container varray
 //
-// Copyright (c) 2012 Andrew Hundt.
-// Copyright (c) 2012 Adam Wulkiewicz, Lodz, Poland.
+// Copyright (c) 2012-2013 Andrew Hundt.
+// Copyright (c) 2012-2013 Adam Wulkiewicz, Lodz, Poland.
 //
 // 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)
 
-#ifndef BOOST_CONTAINER_STATIC_VECTOR_CONCEPT_HPP
-#define BOOST_CONTAINER_STATIC_VECTOR_CONCEPT_HPP
+#ifndef BOOST_CONTAINER_VARRAY_CONCEPT_HPP
+#define BOOST_CONTAINER_VARRAY_CONCEPT_HPP
 
 #include <boost/concept_check.hpp>
 
-namespace boost { namespace container { namespace concept {
+namespace boost { namespace container { namespace container_detail { namespace concept {
   
 /**
- * StaticVectorStrategyConcept
+ * VArrayStrategyConcept
  *
- * \brief Checks strategy for static_vector<Value,Capacity,Strategy>, which has similarities to std::Allocator
- * \ingroup static_vector
+ * \brief Checks strategy for varray<Value,Capacity,Strategy>, which has similarities to std::Allocator
+ * \ingroup varray
  */
 template<typename Strategy>
-struct StaticVectorStrategy {
+struct VArrayStrategy {
 #ifndef DOXYGEN_NO_CONCEPT_MEMBERS
 
     // typedefs are the same as in std::Allocator
@@ -47,7 +47,7 @@
     };
 
 public :
- BOOST_CONCEPT_USAGE(StaticVectorStrategy)
+ BOOST_CONCEPT_USAGE(VArrayStrategy)
     {
         check_methods::apply();
     }
@@ -55,6 +55,6 @@
 #endif
 };
 
-} /*namespace boost*/ } /*namespace container*/ } /*namespace concept*/
+}}}} // namespace boost::container::container_detail::concept
 
-#endif //BOOST_CONTAINER_STATIC_VECTOR_CONCEPT_HPP
+#endif //BOOST_CONTAINER_VARRAY_CONCEPT_HPP

Copied: sandbox/varray/boost/container/detail/varray_util.hpp (from r82619, /sandbox/varray/boost/container/detail/static_vector_util.hpp)
==============================================================================
--- /sandbox/varray/boost/container/detail/static_vector_util.hpp (original)
+++ sandbox/varray/boost/container/detail/varray_util.hpp 2013-01-26 22:36:10 EST (Sat, 26 Jan 2013)
@@ -1,16 +1,16 @@
 // Boost.Container
 //
-// StaticVector details
+// varray details
 //
-// Copyright (c) 2012 Adam Wulkiewicz, Lodz, Poland.
-// Copyright (c) 2011-2012 Andrew Hundt.
+// Copyright (c) 2012-2013 Adam Wulkiewicz, Lodz, Poland.
+// Copyright (c) 2011-2013 Andrew Hundt.
 //
 // 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)
 
-#ifndef BOOST_CONTAINER_DETAIL_STATIC_VECTOR_UTIL_HPP
-#define BOOST_CONTAINER_DETAIL_STATIC_VECTOR_UTIL_HPP
+#ifndef BOOST_CONTAINER_DETAIL_VARRAY_UTIL_HPP
+#define BOOST_CONTAINER_DETAIL_VARRAY_UTIL_HPP
 
 #include <cstddef>
 #include <cstring>
@@ -44,18 +44,18 @@
 
 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
 
-#if defined(BOOST_CONTAINER_STATIC_VECTOR_ENABLE_VECTORS_OPTIMIZATION) && !defined(BOOST_NO_EXCEPTIONS)
+#if defined(BOOST_CONTAINER_VARRAY_ENABLE_VECTORS_OPTIMIZATION) && !defined(BOOST_NO_EXCEPTIONS)
 #include <vector>
 #include <boost/container/vector.hpp>
-#endif // BOOST_CONTAINER_STATIC_VECTOR_ENABLE_ITERATORS_OPTIMIZATION && !BOOST_NO_EXCEPTIONS
+#endif // BOOST_CONTAINER_VARRAY_ENABLE_ITERATORS_OPTIMIZATION && !BOOST_NO_EXCEPTIONS
 
-namespace boost { namespace container { namespace static_vector_detail {
+namespace boost { namespace container { namespace varray_detail {
 
 template <typename I>
 struct are_elements_contiguous : boost::is_pointer<I>
 {};
     
-#if defined(BOOST_CONTAINER_STATIC_VECTOR_ENABLE_VECTORS_OPTIMIZATION) && !defined(BOOST_NO_EXCEPTIONS)
+#if defined(BOOST_CONTAINER_VARRAY_ENABLE_VECTORS_OPTIMIZATION) && !defined(BOOST_NO_EXCEPTIONS)
     
 template <typename Pointer>
 struct are_elements_contiguous<
@@ -106,13 +106,13 @@
     
 #endif // STDLIB
 
-#endif // BOOST_CONTAINER_STATIC_VECTOR_ENABLE_VECTORS_OPTIMIZATION && !BOOST_NO_EXCEPTIONS
+#endif // BOOST_CONTAINER_VARRAY_ENABLE_VECTORS_OPTIMIZATION && !BOOST_NO_EXCEPTIONS
 
-}}} // namespace boost::container::static_vector_detail
+}}} // namespace boost::container::varray_detail
 
 #endif // !BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
 
-namespace boost { namespace container { namespace static_vector_detail {
+namespace boost { namespace container { namespace varray_detail {
 
 // TODO
 // Does BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION checks have any sense?
@@ -549,7 +549,7 @@
 
 // Needed by emplace_back() and emplace()
 
-#if !defined(BOOST_CONTAINER_STATIC_VECTOR_DISABLE_EMPLACE)
+#if !defined(BOOST_CONTAINER_VARRAY_DISABLE_EMPLACE)
 #if !defined(BOOST_NO_VARIADIC_TEMPLATES)
 
 template <typename I, class ...Args>
@@ -583,7 +583,7 @@
 #include BOOST_PP_LOCAL_ITERATE()
 
 #endif // !BOOST_NO_VARIADIC_TEMPLATES
-#endif // !BOOST_CONTAINER_STATIC_VECTOR_DISABLE_EMPLACE
+#endif // !BOOST_CONTAINER_VARRAY_DISABLE_EMPLACE
 
 // assign(I, V)
 
@@ -781,6 +781,6 @@
     T * m_ptr;
 };
 
-}}} // namespace boost::container::static_vector_detail
+}}} // namespace boost::container::varray_detail
 
-#endif // BOOST_CONTAINER_DETAIL_STATIC_VECTOR_UTIL_HPP
+#endif // BOOST_CONTAINER_DETAIL_VARRAY_UTIL_HPP

Deleted: sandbox/varray/boost/container/static_vector.hpp
==============================================================================
--- sandbox/varray/boost/container/static_vector.hpp 2013-01-26 22:36:10 EST (Sat, 26 Jan 2013)
+++ (empty file)
@@ -1,2284 +0,0 @@
-// Boost.Container static_vector
-//
-// Copyright (c) 2012 Adam Wulkiewicz, Lodz, Poland.
-// Copyright (c) 2011-2012 Andrew Hundt.
-//
-// 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)
-
-#ifndef BOOST_CONTAINER_STATIC_VECTOR_HPP
-#define BOOST_CONTAINER_STATIC_VECTOR_HPP
-
-#if (defined _MSC_VER) && (_MSC_VER >= 1200)
-# pragma once
-#endif
-
-#include <boost/container/detail/config_begin.hpp>
-#include <boost/container/detail/workaround.hpp>
-#include <boost/container/detail/preprocessor.hpp>
-
-#include <boost/container/detail/static_vector_util.hpp>
-#include <boost/container/detail/static_vector_concept.hpp>
-#include <boost/iterator/iterator_concepts.hpp>
-
-#ifndef BOOST_NO_EXCEPTIONS
-#include <stdexcept>
-#endif // BOOST_NO_EXCEPTIONS
-
-#include <boost/assert.hpp>
-#include <boost/config.hpp>
-#include <boost/swap.hpp>
-#include <boost/integer.hpp>
-
-#include <boost/mpl/assert.hpp>
-
-#include <boost/type_traits/is_unsigned.hpp>
-#include <boost/type_traits/alignment_of.hpp>
-#include <boost/type_traits/aligned_storage.hpp>
-
-// TODO - use std::reverse_iterator and std::iterator_traits
-// instead Boost.Iterator to remove dependency?
-// or boost/detail/iterator.hpp ?
-#include <boost/iterator/reverse_iterator.hpp>
-
-/**
- * @defgroup static_vector_non_member static_vector non-member functions (boost::container::)
- */
-
-namespace boost { namespace container {
-
-// Forward declaration
-template <typename Value, std::size_t Capacity, typename Strategy>
-class static_vector;
-
-namespace strategy {
-
-// TODO: Improve error messages
-// possibly include N in the strategy, and provide size as an optoinal allocate_failed parameter?
-// Example of current error with reserve(4) when capacity is 3:
-// "boost/container/static_vector.hpp(66): size can't exceed the capacity"
-// Could say
-// "cannot reserve(4) due to fixed capacity of 3 elements"
-
-//! @brief The default strategy.
-//!
-//! @tparam Value Type of element stored in the container.
-template <typename Value>
-struct def
-{
- typedef Value value_type;
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
- typedef Value* pointer;
- typedef const Value* const_pointer;
- typedef Value& reference;
- typedef const Value& const_reference;
-
- static void allocate_failed()
- {
- BOOST_ASSERT_MSG(false, "size can't exceed the capacity");
- }
-};
-
-//! @brief The strategy adapting info from passed Allocator.
-//!
-//! This strategy defines the same types that are defined in the Allocator.
-//!
-//! @tparam Allocator The Allocator which will be adapted.
-template <typename Allocator>
-struct allocator_adaptor
-{
- typedef typename Allocator::value_type value_type;
- typedef typename Allocator::size_type size_type;
- typedef typename Allocator::difference_type difference_type;
- typedef typename Allocator::pointer pointer;
- typedef typename Allocator::const_pointer const_pointer;
- typedef typename Allocator::reference reference;
- typedef typename Allocator::const_reference const_reference;
-
- static void allocate_failed()
- {
- BOOST_ASSERT_MSG(false, "size can't exceed the capacity");
- }
-};
-
-} // namespace strategy
-
-namespace static_vector_detail {
-
-struct default_error_handler
-{
- template <typename V, std::size_t Capacity, typename S>
- static void check_capacity(container::static_vector<V, Capacity, S> const&, std::size_t s)
- {
- if ( Capacity < s )
- S::allocate_failed();
- }
-
- template <typename V, std::size_t C, typename S>
- static void check_at(container::static_vector<V, C, S> const& v,
- typename container::static_vector<V, C, S>::size_type i)
- {
-// TODO - use BOOST_THROW_EXCEPTION here?
-#ifndef BOOST_NO_EXCEPTIONS
- if ( v.size() <= i )
- throw std::out_of_range("index out of bounds");
-#else // BOOST_NO_EXCEPTIONS
- BOOST_ASSERT_MSG(i < v.size(), "index out of bounds");
-#endif // BOOST_NO_EXCEPTIONS
- }
-
- template <typename V, std::size_t C, typename S>
- static void check_operator_brackets(container::static_vector<V, C, S> const& v,
- typename container::static_vector<V, C, S>::size_type i)
- {
- BOOST_ASSERT_MSG(i < v.size(), "index out of bounds");
- }
-
- template <typename V, std::size_t C, typename S>
- static void check_empty(container::static_vector<V, C, S> const& v)
- {
- BOOST_ASSERT_MSG(0 < v.size(), "the container is empty");
- }
-
- template <typename V, std::size_t C, typename S>
- static void check_iterator_end_neq(container::static_vector<V, C, S> const& v,
- typename container::static_vector<V, C, S>::const_iterator position)
- {
- BOOST_ASSERT_MSG(v.begin() <= position && position < v.end(), "iterator out of bounds");
- }
-
- template <typename V, std::size_t C, typename S>
- static void check_iterator_end_eq(container::static_vector<V, C, S> const& v,
- typename container::static_vector<V, C, S>::const_iterator position)
- {
- BOOST_ASSERT_MSG(v.begin() <= position && position <= v.end(), "iterator out of bounds");
- }
-};
-
-template <typename Value, std::size_t Capacity, typename Strategy>
-struct static_vector_traits
-{
- typedef typename Strategy::value_type value_type;
- typedef typename Strategy::size_type size_type;
- typedef typename Strategy::difference_type difference_type;
- typedef typename Strategy::pointer pointer;
- typedef typename Strategy::const_pointer const_pointer;
- typedef typename Strategy::reference reference;
- typedef typename Strategy::const_reference const_reference;
-
- typedef default_error_handler error_handler;
-
- typedef boost::false_type use_memop_in_swap_and_move;
- typedef boost::false_type use_optimized_swap;
-};
-
-} // namespace static_vector_detail
-
-/**
- * @brief A hybrid of \c boost::container::vector and \c boost::array with fixed capacity.
- *
- * static_vector is a sequence container like boost::container::vector with contiguous storage that can
- * change in size, along with the static allocation, low overhead, and fixed capacity of boost::array.
- *
- * A static_vector is a sequence that supports random access to elements, constant time insertion and
- * removal of elements at the end, and linear time insertion and removal of elements at the beginning or
- * in the middle. The number of elements in a static_vector may vary dynamically up to a fixed capacity
- * because elements are stored within the object itself similarly to an array. However, objects are
- * initialized as they are inserted into static_vector unlike C arrays or std::array which must construct
- * all elements on instantiation. The behavior of static_vector enables the use of statically allocated
- * elements in cases with complex object lifetime requirements that would otherwise not be trivially
- * possible.
- *
- * @par Error Handling
- * Insertion beyond the capacity and out of bounds errors result in undefined behavior unless
- * otherwise specified. In this respect if size() == capacity(), then static_vector::push_back()
- * behaves like std::vector pop_front() if size() == empty(). The reason for this difference
- * is because unlike vectors, static_vector does not perform allocation.
- *
- * @par Advanced Usage
- * Error handling behavior can be modified to more closely match std::vector exception behavior
- * when exceeding bounds by providing an alternate Strategy and static_vector_traits instantiation.
- *
- * @tparam Value The type of element that will be stored.
- * @tparam Capacity The maximum number of elements static_vector can store, fixed at compile time.
- * @tparam Strategy Defines the public typedefs and error handlers,
- * implements StaticVectorStrategy and has some similarities
- * to an Allocator.
- */
-template <typename Value, std::size_t Capacity, typename Strategy = strategy::def<Value> >
-class static_vector
-{
- typedef static_vector_detail::static_vector_traits<
- Value, Capacity, Strategy
- > vt;
-
- typedef typename vt::error_handler errh;
-
- BOOST_MPL_ASSERT_MSG(
- ( boost::is_unsigned<typename vt::size_type>::value &&
- sizeof(typename boost::uint_value_t<Capacity>::least) <= sizeof(typename vt::size_type) ),
- SIZE_TYPE_IS_TOO_SMALL_FOR_SPECIFIED_CAPACITY,
- (static_vector)
- );
-
- BOOST_CONCEPT_ASSERT((concept::StaticVectorStrategy<Strategy>));
-
- typedef boost::aligned_storage<
- sizeof(Value[Capacity]),
- boost::alignment_of<Value[Capacity]>::value
- > aligned_storage_type;
-
- template <typename V, std::size_t C, typename S>
- friend class static_vector;
-
- BOOST_COPYABLE_AND_MOVABLE(static_vector)
-
-#ifdef BOOST_NO_RVALUE_REFERENCES
-public:
- template <std::size_t C, typename S>
- static_vector & operator=(static_vector<Value, C, S> & sv)
- {
- typedef static_vector<Value, C, S> other;
- this->operator=(static_cast<const ::boost::rv<other> &>(const_cast<const other &>(sv)));
- return *this;
- }
-#endif
-
-public:
- //! @brief The type of elements stored in the container.
- typedef typename vt::value_type value_type;
- //! @brief The unsigned integral type used by the container.
- typedef typename vt::size_type size_type;
- //! @brief The pointers difference type.
- typedef typename vt::difference_type difference_type;
- //! @brief The pointer type.
- typedef typename vt::pointer pointer;
- //! @brief The const pointer type.
- typedef typename vt::const_pointer const_pointer;
- //! @brief The value reference type.
- typedef typename vt::reference reference;
- //! @brief The value const reference type.
- typedef typename vt::const_reference const_reference;
-
- //! @brief The iterator type.
- typedef pointer iterator;
- //! @brief The const iterator type.
- typedef const_pointer const_iterator;
- //! @brief The reverse iterator type.
- typedef boost::reverse_iterator<iterator> reverse_iterator;
- //! @brief The const reverse iterator.
- typedef boost::reverse_iterator<const_iterator> const_reverse_iterator;
-
- //! @brief The type of a strategy used by the static_vector.
- typedef Strategy strategy_type;
-
- //! @brief Constructs an empty static_vector.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- static_vector()
- : m_size(0)
- {}
-
- //! @pre <tt>count <= capacity()</tt>
- //!
- //! @brief Constructs a static_vector containing count default constructed Values.
- //!
- //! @param count The number of values which will be contained in the container.
- //!
- //! @par Throws
- //! If Value's default constructor throws.
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Linear O(N).
- explicit static_vector(size_type count)
- : m_size(0)
- {
- this->resize(count); // may throw
- }
-
- //! @pre <tt>count <= capacity()</tt>
- //!
- //! @brief Constructs a static_vector containing count copies of value.
- //!
- //! @param count The number of copies of a values that will be contained in the container.
- //! @param value The value which will be used to copy construct values.
- //!
- //! @par Throws
- //! If Value's copy constructor throws.
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Linear O(N).
- static_vector(size_type count, value_type const& value)
- : m_size(0)
- {
- this->resize(count, value); // may throw
- }
-
- //! @pre
- //! @li <tt>distance(first, last) <= capacity()</tt>
- //! @li Iterator must meet the \c ForwardTraversalIterator concept.
- //!
- //! @brief Constructs a static_vector containing copy of a range <tt>[first, last)</tt>.
- //!
- //! @param first The iterator to the first element in range.
- //! @param last The iterator to the one after the last element in range.
- //!
- //! @par Throws
- //! If Value's constructor taking a dereferenced Iterator throws.
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Linear O(N).
- template <typename Iterator>
- static_vector(Iterator first, Iterator last)
- : m_size(0)
- {
- BOOST_CONCEPT_ASSERT((boost_concepts::ForwardTraversal<Iterator>)); // Make sure you passed a ForwardIterator
-
- this->assign(first, last); // may throw
- }
-
- //! @brief Constructs a copy of other static_vector.
- //!
- //! @param other The static_vector which content will be copied to this one.
- //!
- //! @par Throws
- //! If Value's copy constructor throws.
- //!
- //! @par Complexity
- //! Linear O(N).
- static_vector(static_vector const& other)
- : m_size(other.size())
- {
- namespace sv = static_vector_detail;
- sv::uninitialized_copy(other.begin(), other.end(), this->begin()); // may throw
- }
-
- //! @pre <tt>other.size() <= capacity()</tt>.
- //!
- //! @brief Constructs a copy of other static_vector.
- //!
- //! @param other The static_vector which content will be copied to this one.
- //!
- //! @par Throws
- //! If Value's copy constructor throws.
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Linear O(N).
- template <std::size_t C, typename S>
- static_vector(static_vector<value_type, C, S> const& other)
- : m_size(other.size())
- {
- errh::check_capacity(*this, other.size()); // may throw
-
- namespace sv = static_vector_detail;
- sv::uninitialized_copy(other.begin(), other.end(), this->begin()); // may throw
- }
-
- //! @brief Copy assigns Values stored in the other static_vector to this one.
- //!
- //! @param other The static_vector which content will be copied to this one.
- //!
- //! @par Throws
- //! If Value's copy constructor or copy assignment throws.
- //!
- //! @par Complexity
- //! Linear O(N).
- static_vector & operator=(BOOST_COPY_ASSIGN_REF(static_vector) other)
- {
- this->assign(other.begin(), other.end()); // may throw
-
- return *this;
- }
-
- //! @pre <tt>other.size() <= capacity()</tt>
- //!
- //! @brief Copy assigns Values stored in the other static_vector to this one.
- //!
- //! @param other The static_vector which content will be copied to this one.
- //!
- //! @par Throws
- //! If Value's copy constructor or copy assignment throws.
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Linear O(N).
- template <std::size_t C, typename S>
-// TEMPORARY WORKAROUND
-#if defined(BOOST_NO_RVALUE_REFERENCES)
- static_vector & operator=(::boost::rv< static_vector<value_type, C, S> > const& other)
-#else
- static_vector & operator=(static_vector<value_type, C, S> const& other)
-#endif
- {
- this->assign(other.begin(), other.end()); // may throw
-
- return *this;
- }
-
- //! @brief Move constructor. Moves Values stored in the other static_vector to this one.
- //!
- //! @param other The static_vector which content will be moved to this one.
- //!
- //! @par Throws
- //! @li If \c boost::has_nothrow_move<Value>::value is \c true and Value's move constructor throws.
- //! @li If \c boost::has_nothrow_move<Value>::value is \c false and Value's copy constructor throws.
- //! @internal
- //! @li It throws only if \c use_memop_in_swap_and_move is \c false_type - default.
- //! @endinternal
- //!
- //! @par Complexity
- //! Linear O(N).
- static_vector(BOOST_RV_REF(static_vector) other)
- {
- typedef typename
- static_vector_detail::static_vector_traits<
- Value, Capacity, Strategy
- >::use_memop_in_swap_and_move use_memop_in_swap_and_move;
-
- this->move_ctor_dispatch(other, use_memop_in_swap_and_move());
- }
-
- //! @pre <tt>other.size() <= capacity()</tt>
- //!
- //! @brief Move constructor. Moves Values stored in the other static_vector to this one.
- //!
- //! @param other The static_vector which content will be moved to this one.
- //!
- //! @par Throws
- //! @li If \c boost::has_nothrow_move<Value>::value is \c true and Value's move constructor throws.
- //! @li If \c boost::has_nothrow_move<Value>::value is \c false and Value's copy constructor throws.
- //! @internal
- //! @li It throws only if \c use_memop_in_swap_and_move is false_type - default.
- //! @endinternal
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Linear O(N).
- template <std::size_t C, typename S>
- static_vector(BOOST_RV_REF_3_TEMPL_ARGS(static_vector, value_type, C, S) other)
- : m_size(other.m_size)
- {
- errh::check_capacity(*this, other.size()); // may throw
-
- typedef typename
- static_vector_detail::static_vector_traits<
- Value, Capacity, Strategy
- >::use_memop_in_swap_and_move use_memop_in_swap_and_move;
-
- this->move_ctor_dispatch(other, use_memop_in_swap_and_move());
- }
-
- //! @brief Move assignment. Moves Values stored in the other static_vector to this one.
- //!
- //! @param other The static_vector which content will be moved to this one.
- //!
- //! @par Throws
- //! @li If \c boost::has_nothrow_move<Value>::value is \c true and Value's move constructor or move assignment throws.
- //! @li If \c boost::has_nothrow_move<Value>::value is \c false and Value's copy constructor or copy assignment throws.
- //! @internal
- //! @li It throws only if \c use_memop_in_swap_and_move is \c false_type - default.
- //! @endinternal
- //!
- //! @par Complexity
- //! Linear O(N).
- static_vector & operator=(BOOST_RV_REF(static_vector) other)
- {
- if ( &other == this )
- return *this;
-
- typedef typename
- static_vector_detail::static_vector_traits<
- Value, Capacity, Strategy
- >::use_memop_in_swap_and_move use_memop_in_swap_and_move;
-
- this->move_assign_dispatch(other, use_memop_in_swap_and_move());
-
- return *this;
- }
-
- //! @pre <tt>other.size() <= capacity()</tt>
- //!
- //! @brief Move assignment. Moves Values stored in the other static_vector to this one.
- //!
- //! @param other The static_vector which content will be moved to this one.
- //!
- //! @par Throws
- //! @li If \c boost::has_nothrow_move<Value>::value is \c true and Value's move constructor or move assignment throws.
- //! @li If \c boost::has_nothrow_move<Value>::value is \c false and Value's copy constructor or copy assignment throws.
- //! @internal
- //! @li It throws only if \c use_memop_in_swap_and_move is \c false_type - default.
- //! @endinternal
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Linear O(N).
- template <std::size_t C, typename S>
- static_vector & operator=(BOOST_RV_REF_3_TEMPL_ARGS(static_vector, value_type, C, S) other)
- {
- errh::check_capacity(*this, other.size()); // may throw
-
- typedef typename
- static_vector_detail::static_vector_traits<
- Value, Capacity, Strategy
- >::use_memop_in_swap_and_move use_memop_in_swap_and_move;
-
- this->move_assign_dispatch(other, use_memop_in_swap_and_move());
-
- return *this;
- }
-
- //! @brief Destructor. Destroys Values stored in this container.
- //!
- //! @par Throws
- //! Nothing
- //!
- //! @par Complexity
- //! Linear O(N).
- ~static_vector()
- {
- namespace sv = static_vector_detail;
- sv::destroy(this->begin(), this->end());
- }
-
- //! @brief Swaps contents of the other static_vector and this one.
- //!
- //! @param other The static_vector which content will be swapped with this one's content.
- //!
- //! @par Throws
- //! @li If \c boost::has_nothrow_move<Value>::value is \c true and Value's move constructor or move assignment throws,
- //! @li If \c boost::has_nothrow_move<Value>::value is \c false and Value's copy constructor or copy assignment throws,
- //! @internal
- //! @li It throws only if \c use_memop_in_swap_and_move and \c use_optimized_swap are \c false_type - default.
- //! @endinternal
- //!
- //! @par Complexity
- //! Linear O(N).
- void swap(static_vector & other)
- {
- typedef typename
- static_vector_detail::static_vector_traits<
- Value, Capacity, Strategy
- >::use_optimized_swap use_optimized_swap;
-
- this->swap_dispatch(other, use_optimized_swap());
- }
-
- //! @pre <tt>other.size() <= capacity() && size() <= other.capacity()</tt>
- //!
- //! @brief Swaps contents of the other static_vector and this one.
- //!
- //! @param other The static_vector which content will be swapped with this one's content.
- //!
- //! @par Throws
- //! @li If \c boost::has_nothrow_move<Value>::value is \c true and Value's move constructor or move assignment throws,
- //! @li If \c boost::has_nothrow_move<Value>::value is \c false and Value's copy constructor or copy assignment throws,
- //! @internal
- //! @li It throws only if \c use_memop_in_swap_and_move and \c use_optimized_swap are \c false_type - default.
- //! @endinternal
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Linear O(N).
- template <std::size_t C, typename S>
- void swap(static_vector<value_type, C, S> & other)
- {
- errh::check_capacity(*this, other.size());
- errh::check_capacity(other, this->size());
-
- typedef typename
- static_vector_detail::static_vector_traits<
- Value, Capacity, Strategy
- >::use_optimized_swap use_optimized_swap;
-
- this->swap_dispatch(other, use_optimized_swap());
- }
-
- //! @pre <tt>count <= capacity()</tt>
- //!
- //! @brief Inserts or erases elements at the end such that
- //! the size becomes count. New elements are default constructed.
- //!
- //! @param count The number of elements which will be stored in the container.
- //!
- //! @par Throws
- //! If Value's default constructor throws.
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Linear O(N).
- void resize(size_type count)
- {
- namespace sv = static_vector_detail;
-
- if ( count < m_size )
- {
- sv::destroy(this->begin() + count, this->end());
- }
- else
- {
- errh::check_capacity(*this, count); // may throw
-
- sv::uninitialized_fill(this->end(), this->begin() + count); // may throw
- }
- m_size = count; // update end
- }
-
- //! @pre <tt>count <= capacity()</tt>
- //!
- //! @brief Inserts or erases elements at the end such that
- //! the size becomes count. New elements are copy constructed from value.
- //!
- //! @param count The number of elements which will be stored in the container.
- //! @param value The value used to copy construct the new element.
- //!
- //! @par Throws
- //! If Value's copy constructor throws.
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Linear O(N).
- void resize(size_type count, value_type const& value)
- {
- if ( count < m_size )
- {
- namespace sv = static_vector_detail;
- sv::destroy(this->begin() + count, this->end());
- }
- else
- {
- errh::check_capacity(*this, count); // may throw
-
- std::uninitialized_fill(this->end(), this->begin() + count, value); // may throw
- }
- m_size = count; // update end
- }
-
- //! @pre <tt>count <= capacity()</tt>
- //!
- //! @brief This call has no effect because the Capacity of this container is constant.
- //!
- //! @param count The number of elements which the container should be able to contain.
- //!
- //! @par Throws
- //! Nothing.
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Linear O(N).
- void reserve(size_type count)
- {
- errh::check_capacity(*this, count); // may throw
- }
-
- //! @pre <tt>size() < capacity()</tt>
- //!
- //! @brief Adds a copy of value at the end.
- //!
- //! @param value The value used to copy construct the new element.
- //!
- //! @par Throws
- //! If Value's copy constructor throws.
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Constant O(1).
- void push_back(value_type const& value)
- {
- errh::check_capacity(*this, m_size + 1); // may throw
-
- namespace sv = static_vector_detail;
- sv::construct(this->end(), value); // may throw
- ++m_size; // update end
- }
-
- //! @pre <tt>size() < capacity()</tt>
- //!
- //! @brief Moves value to the end.
- //!
- //! @param value The value to move construct the new element.
- //!
- //! @par Throws
- //! If Value's move constructor throws.
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Constant O(1).
- void push_back(BOOST_RV_REF(value_type) value)
- {
- errh::check_capacity(*this, m_size + 1); // may throw
-
- namespace sv = static_vector_detail;
- sv::construct(this->end(), value); // may throw
- ++m_size; // update end
- }
-
- //! @pre <tt>!empty()</tt>
- //!
- //! @brief Destroys last value and decreases the size.
- //!
- //! @par Throws
- //! Nothing by default.
- //!
- //! @par Complexity
- //! Constant O(1).
- void pop_back()
- {
- errh::check_empty(*this);
-
- namespace sv = static_vector_detail;
- sv::destroy(this->end() - 1);
- --m_size; // update end
- }
-
- //! @pre
- //! @li \c position must be a valid iterator of \c *this in range <tt>[begin(), end()]</tt>.
- //! @li <tt>size() < capacity()</tt>
- //!
- //! @brief Inserts a copy of element at position.
- //!
- //! @param position The position at which the new value will be inserted.
- //! @param value The value used to copy construct the new element.
- //!
- //! @par Throws
- //! @li If Value's copy constructor or copy assignment throws
- //! @li If Value's move constructor or move assignment throws.
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Constant or linear.
- iterator insert(iterator position, value_type const& value)
- {
- return this->priv_insert(position, value);
- }
-
- //! @pre
- //! @li \c position must be a valid iterator of \c *this in range <tt>[begin(), end()]</tt>.
- //! @li <tt>size() < capacity()</tt>
- //!
- //! @brief Inserts a move-constructed element at position.
- //!
- //! @param position The position at which the new value will be inserted.
- //! @param value The value used to move construct the new element.
- //!
- //! @par Throws
- //! If Value's move constructor or move assignment throws.
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Constant or linear.
- iterator insert(iterator position, BOOST_RV_REF(value_type) value)
- {
- return this->priv_insert(position, value);
- }
-
- //! @pre
- //! @li \c position must be a valid iterator of \c *this in range <tt>[begin(), end()]</tt>.
- //! @li <tt>size() + count <= capacity()</tt>
- //!
- //! @brief Inserts a count copies of value at position.
- //!
- //! @param position The position at which new elements will be inserted.
- //! @param count The number of new elements which will be inserted.
- //! @param value The value used to copy construct new elements.
- //!
- //! @par Throws
- //! @li If Value's copy constructor or copy assignment throws.
- //! @li If Value's move constructor or move assignment throws.
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Linear O(N).
- iterator insert(iterator position, size_type count, value_type const& value)
- {
- errh::check_iterator_end_eq(*this, position);
- errh::check_capacity(*this, m_size + count); // may throw
-
- if ( position == this->end() )
- {
- std::uninitialized_fill(position, position + count, value); // may throw
- m_size += count; // update end
- }
- else
- {
- namespace sv = static_vector_detail;
-
- difference_type to_move = std::distance(position, this->end());
-
- // TODO - should following lines check for exception and revert to the old size?
-
- if ( count < static_cast<size_type>(to_move) )
- {
- sv::uninitialized_move(this->end() - count, this->end(), this->end()); // may throw
- m_size += count; // update end
- sv::move_backward(position, position + to_move - count, this->end() - count); // may throw
- std::fill_n(position, count, value); // may throw
- }
- else
- {
- std::uninitialized_fill(this->end(), position + count, value); // may throw
- m_size += count - to_move; // update end
- sv::uninitialized_move(position, position + to_move, position + count); // may throw
- m_size += to_move; // update end
- std::fill_n(position, to_move, value); // may throw
- }
- }
-
- return position;
- }
-
- //! @pre
- //! @li \c position must be a valid iterator of \c *this in range <tt>[begin(), end()]</tt>.
- //! @li <tt>distance(first, last) <= capacity()</tt>
- //! @li \c Iterator must meet the \c ForwardTraversalIterator concept.
- //!
- //! @brief Inserts a copy of a range <tt>[first, last)</tt> at position.
- //!
- //! @param position The position at which new elements will be inserted.
- //! @param first The iterator to the first element of a range used to construct new elements.
- //! @param last The iterator to the one after the last element of a range used to construct new elements.
- //!
- //! @par Throws
- //! @li If Value's constructor and assignment taking a dereferenced \c Iterator.
- //! @li If Value's move constructor or move assignment throws.
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Linear O(N).
- template <typename Iterator>
- iterator insert(iterator position, Iterator first, Iterator last)
- {
- BOOST_CONCEPT_ASSERT((boost_concepts::ForwardTraversal<Iterator>)); // Make sure you passed a ForwardIterator
-
- typedef typename boost::iterator_traversal<Iterator>::type traversal;
- this->insert_dispatch(position, first, last, traversal());
-
- return position;
- }
-
- //! @pre \c position must be a valid iterator of \c *this in range <tt>[begin(), end())</tt>
- //!
- //! @brief Erases Value from position.
- //!
- //! @param position The position of the element which will be erased from the container.
- //!
- //! @par Throws
- //! If Value's move assignment throws.
- //!
- //! @par Complexity
- //! Linear O(N).
- iterator erase(iterator position)
- {
- namespace sv = static_vector_detail;
-
- errh::check_iterator_end_neq(*this, position);
-
- //TODO - add empty check?
- //errh::check_empty(*this);
-
- sv::move(position + 1, this->end(), position); // may throw
- sv::destroy(this->end() - 1);
- --m_size;
-
- return position;
- }
-
- //! @pre
- //! @li \c first and \c last must define a valid range
- //! @li iterators must be in range <tt>[begin(), end()]</tt>
- //!
- //! @brief Erases Values from a range <tt>[first, last)</tt>.
- //!
- //! @param first The position of the first element of a range which will be erased from the container.
- //! @param last The position of the one after the last element of a range which will be erased from the container.
- //!
- //! @par Throws
- //! If Value's move assignment throws.
- //!
- //! @par Complexity
- //! Linear O(N).
- iterator erase(iterator first, iterator last)
- {
- namespace sv = static_vector_detail;
-
- errh::check_iterator_end_eq(*this, first);
- errh::check_iterator_end_eq(*this, last);
-
- difference_type n = std::distance(first, last);
-
- //TODO - add invalid range check?
- //BOOST_ASSERT_MSG(0 <= n, "invalid range");
- //TODO - add this->size() check?
- //BOOST_ASSERT_MSG(n <= this->size(), "invalid range");
-
- sv::move(last, this->end(), first); // may throw
- sv::destroy(this->end() - n, this->end());
- m_size -= n;
-
- return first;
- }
-
- //! @pre <tt>distance(first, last) <= capacity()</tt>
- //!
- //! @brief Assigns a range <tt>[first, last)</tt> of Values to this container.
- //!
- //! @param first The iterator to the first element of a range used to construct new content of this container.
- //! @param last The iterator to the one after the last element of a range used to construct new content of this container.
- //!
- //! @par Throws
- //! If Value's copy constructor or copy assignment throws,
- //!
- //! @par Complexity
- //! Linear O(N).
- template <typename Iterator>
- void assign(Iterator first, Iterator last)
- {
- BOOST_CONCEPT_ASSERT((boost_concepts::ForwardTraversal<Iterator>)); // Make sure you passed a ForwardIterator
-
- typedef typename boost::iterator_traversal<Iterator>::type traversal;
- this->assign_dispatch(first, last, traversal()); // may throw
- }
-
- //! @pre <tt>count <= capacity()</tt>
- //!
- //! @brief Assigns a count copies of value to this container.
- //!
- //! @param count The new number of elements which will be container in the container.
- //! @param value The value which will be used to copy construct the new content.
- //!
- //! @par Throws
- //! If Value's copy constructor or copy assignment throws.
- //!
- //! @par Complexity
- //! Linear O(N).
- void assign(size_type count, value_type const& value)
- {
- if ( count < m_size )
- {
- namespace sv = static_vector_detail;
-
- std::fill_n(this->begin(), count, value);
- sv::destroy(this->begin() + count, this->end());
- }
- else
- {
- errh::check_capacity(*this, count); // may throw
-
- std::fill_n(this->begin(), m_size, value);
- std::uninitialized_fill(this->end(), this->begin() + count, value); // may throw
- }
- m_size = count; // update end
- }
-
-#if !defined(BOOST_CONTAINER_STATIC_VECTOR_DISABLE_EMPLACE)
-#if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
- //! @pre <tt>size() < capacity()</tt>
- //!
- //! @brief Inserts a Value constructed with
- //! \c std::forward<Args>(args)... in the end of the container.
- //!
- //! @param args The arguments of the constructor of the new element which will be created at the end of the container.
- //!
- //! @par Throws
- //! If in-place constructor throws or Value's move constructor throws.
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Constant O(1).
- template<class ...Args>
- void emplace_back(Args &&...args)
- {
- errh::check_capacity(*this, m_size + 1); // may throw
-
- namespace sv = static_vector_detail;
- sv::construct(this->end(), ::boost::forward<Args>(args)...); // may throw
- ++m_size; // update end
- }
-
- //! @pre
- //! @li \c position must be a valid iterator of \c *this in range <tt>[begin(), end()]</tt>
- //! @li <tt>size() < capacity()</tt>
- //!
- //! @brief Inserts a Value constructed with
- //! \c std::forward<Args>(args)... before position
- //!
- //! @param position The position at which new elements will be inserted.
- //! @param args The arguments of the constructor of the new element.
- //!
- //! @par Throws
- //! If in-place constructor throws or if Value's move constructor or move assignment throws.
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Constant or linear.
- template<class ...Args>
- iterator emplace(iterator position, Args &&...args)
- {
- namespace sv = static_vector_detail;
-
- errh::check_iterator_end_eq(*this, position);
- errh::check_capacity(*this, m_size + 1); // may throw
-
- if ( position == this->end() )
- {
- sv::construct(position, ::boost::forward<Args>(args)...); // may throw
- ++m_size; // update end
- }
- else
- {
- // TODO - should following lines check for exception and revert to the old size?
-
- // TODO - should move be used only if it's nonthrowing?
- value_type & r = *(this->end() - 1);
- sv::construct(this->end(), boost::move(r)); // may throw
- ++m_size; // update end
- sv::move_backward(position, this->end() - 2, this->end() - 1); // may throw
-
- aligned_storage<sizeof(value_type), alignment_of<value_type>::value> temp_storage;
- value_type * val_p = static_cast<value_type *>(temp_storage.address());
- sv::construct(val_p, ::boost::forward<Args>(args)...); // may throw
- sv::scoped_destructor<value_type> d(val_p);
- sv::assign(position, ::boost::move(*val_p)); // may throw
- }
-
- return position;
- }
-
-#else // BOOST_CONTAINER_PERFECT_FORWARDING || BOOST_CONTAINER_DOXYGEN_INVOKED
-
- #define BOOST_PP_LOCAL_MACRO(n) \
- BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
- void emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
- { \
- errh::check_capacity(*this, m_size + 1); /*may throw*/\
- \
- namespace sv = static_vector_detail; \
- sv::construct(this->end() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ); /*may throw*/\
- ++m_size; /*update end*/ \
- } \
- //
- #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
- #include BOOST_PP_LOCAL_ITERATE()
-
- #define BOOST_PP_LOCAL_MACRO(n) \
- BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
- iterator emplace(iterator position BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
- { \
- namespace sv = static_vector_detail; \
- \
- errh::check_iterator_end_eq(*this, position); \
- errh::check_capacity(*this, m_size + 1); /*may throw*/\
- \
- if ( position == this->end() ) \
- { \
- sv::construct(position BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ); /*may throw*/\
- ++m_size; /*update end*/ \
- } \
- else \
- { \
- /* TODO - should following lines check for exception and revert to the old size? */ \
- /* TODO - should move be used only if it's nonthrowing? */ \
- \
- value_type & r = *(this->end() - 1); \
- sv::construct(this->end(), boost::move(r)); /*may throw*/\
- ++m_size; /*update end*/ \
- sv::move_backward(position, this->end() - 2, this->end() - 1); /*may throw*/\
- \
- aligned_storage<sizeof(value_type), alignment_of<value_type>::value> temp_storage; \
- value_type * val_p = static_cast<value_type *>(temp_storage.address()); \
- sv::construct(val_p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ); /*may throw*/\
- sv::scoped_destructor<value_type> d(val_p); \
- sv::assign(position, ::boost::move(*val_p)); /*may throw*/\
- } \
- \
- return position; \
- } \
- //
- #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
- #include BOOST_PP_LOCAL_ITERATE()
-
-#endif // BOOST_CONTAINER_PERFECT_FORWARDING || BOOST_CONTAINER_DOXYGEN_INVOKED
-#endif // !BOOST_CONTAINER_STATIC_VECTOR_DISABLE_EMPLACE
-
- //! @brief Removes all elements from the container.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- void clear()
- {
- namespace sv = static_vector_detail;
- sv::destroy(this->begin(), this->end());
- m_size = 0; // update end
- }
-
- //! @pre <tt>i < size()</tt>
- //!
- //! @brief Returns reference to the i-th element.
- //!
- //! @param i The element's index.
- //!
- //! @return reference to the i-th element
- //! from the beginning of the container.
- //!
- //! @par Throws
- //! \c std::out_of_range exception by default.
- //!
- //! @par Complexity
- //! Constant O(1).
- reference at(size_type i)
- {
- errh::check_at(*this, i); // may throw
- return *(this->begin() + i);
- }
-
- //! @pre <tt>i < size()</tt>
- //!
- //! @brief Returns const reference to the i-th element.
- //!
- //! @param i The element's index.
- //!
- //! @return const reference to the i-th element
- //! from the beginning of the container.
- //!
- //! @par Throws
- //! \c std::out_of_range exception by default.
- //!
- //! @par Complexity
- //! Constant O(1).
- const_reference at(size_type i) const
- {
- errh::check_at(*this, i); // may throw
- return *(this->begin() + i);
- }
-
- //! @pre <tt>i < size()</tt>
- //!
- //! @brief Returns reference to the i-th element.
- //!
- //! @param i The element's index.
- //!
- //! @return reference to the i-th element
- //! from the beginning of the container.
- //!
- //! @par Throws
- //! Nothing by default.
- //!
- //! @par Complexity
- //! Constant O(1).
- reference operator[](size_type i)
- {
- // TODO: Remove bounds check? std::vector and std::array operator[] don't check.
- errh::check_operator_brackets(*this, i);
- return *(this->begin() + i);
- }
-
- //! @pre <tt>i < size()</tt>
- //!
- //! @brief Returns const reference to the i-th element.
- //!
- //! @param i The element's index.
- //!
- //! @return const reference to the i-th element
- //! from the beginning of the container.
- //!
- //! @par Throws
- //! Nothing by default.
- //!
- //! @par Complexity
- //! Constant O(1).
- const_reference operator[](size_type i) const
- {
- errh::check_operator_brackets(*this, i);
- return *(this->begin() + i);
- }
-
- //! @pre \c !empty()
- //!
- //! @brief Returns reference to the first element.
- //!
- //! @return reference to the first element
- //! from the beginning of the container.
- //!
- //! @par Throws
- //! Nothing by default.
- //!
- //! @par Complexity
- //! Constant O(1).
- reference front()
- {
- errh::check_empty(*this);
- return *(this->begin());
- }
-
- //! @pre \c !empty()
- //!
- //! @brief Returns const reference to the first element.
- //!
- //! @return const reference to the first element
- //! from the beginning of the container.
- //!
- //! @par Throws
- //! Nothing by default.
- //!
- //! @par Complexity
- //! Constant O(1).
- const_reference front() const
- {
- errh::check_empty(*this);
- return *(this->begin());
- }
-
- //! @pre \c !empty()
- //!
- //! @brief Returns reference to the last element.
- //!
- //! @return reference to the last element
- //! from the beginning of the container.
- //!
- //! @par Throws
- //! Nothing by default.
- //!
- //! @par Complexity
- //! Constant O(1).
- reference back()
- {
- errh::check_empty(*this);
- return *(this->end() - 1);
- }
-
- //! @pre \c !empty()
- //!
- //! @brief Returns const reference to the first element.
- //!
- //! @return const reference to the last element
- //! from the beginning of the container.
- //!
- //! @par Throws
- //! Nothing by default.
- //!
- //! @par Complexity
- //! Constant O(1).
- const_reference back() const
- {
- errh::check_empty(*this);
- return *(this->end() - 1);
- }
-
- //! @brief Pointer such that <tt>[data(), data() + size())</tt> is a valid range.
- //! For a non-empty vector <tt>data() == &front()</tt>.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- Value * data()
- {
- return boost::addressof(*(this->ptr()));
- }
-
- //! @brief Const pointer such that <tt>[data(), data() + size())</tt> is a valid range.
- //! For a non-empty vector <tt>data() == &front()</tt>.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- const Value * data() const
- {
- return boost::addressof(*(this->ptr()));
- }
-
-
- //! @brief Returns iterator to the first element.
- //!
- //! @return iterator to the first element contained in the vector.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- iterator begin() { return this->ptr(); }
-
- //! @brief Returns const iterator to the first element.
- //!
- //! @return const_iterator to the first element contained in the vector.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- const_iterator begin() const { return this->ptr(); }
-
- //! @brief Returns const iterator to the first element.
- //!
- //! @return const_iterator to the first element contained in the vector.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- const_iterator cbegin() const { return this->ptr(); }
-
- //! @brief Returns iterator to the one after the last element.
- //!
- //! @return iterator pointing to the one after the last element contained in the vector.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- iterator end() { return this->begin() + m_size; }
-
- //! @brief Returns const iterator to the one after the last element.
- //!
- //! @return const_iterator pointing to the one after the last element contained in the vector.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- const_iterator end() const { return this->begin() + m_size; }
-
- //! @brief Returns const iterator to the one after the last element.
- //!
- //! @return const_iterator pointing to the one after the last element contained in the vector.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- const_iterator cend() const { return this->cbegin() + m_size; }
-
- //! @brief Returns reverse iterator to the first element of the reversed container.
- //!
- //! @return reverse_iterator pointing to the beginning
- //! of the reversed static_vector.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- reverse_iterator rbegin() { return reverse_iterator(this->end()); }
-
- //! @brief Returns const reverse iterator to the first element of the reversed container.
- //!
- //! @return const_reverse_iterator pointing to the beginning
- //! of the reversed static_vector.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- const_reverse_iterator rbegin() const { return reverse_iterator(this->end()); }
-
- //! @brief Returns const reverse iterator to the first element of the reversed container.
- //!
- //! @return const_reverse_iterator pointing to the beginning
- //! of the reversed static_vector.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- const_reverse_iterator crbegin() const { return reverse_iterator(this->end()); }
-
- //! @brief Returns reverse iterator to the one after the last element of the reversed container.
- //!
- //! @return reverse_iterator pointing to the one after the last element
- //! of the reversed static_vector.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- reverse_iterator rend() { return reverse_iterator(this->begin()); }
-
- //! @brief Returns const reverse iterator to the one after the last element of the reversed container.
- //!
- //! @return const_reverse_iterator pointing to the one after the last element
- //! of the reversed static_vector.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- const_reverse_iterator rend() const { return reverse_iterator(this->begin()); }
-
- //! @brief Returns const reverse iterator to the one after the last element of the reversed container.
- //!
- //! @return const_reverse_iterator pointing to the one after the last element
- //! of the reversed static_vector.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- const_reverse_iterator crend() const { return reverse_iterator(this->begin()); }
-
- //! @brief Returns container's capacity.
- //!
- //! @return container's capacity.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- static size_type capacity() { return Capacity; }
-
- //! @brief Returns container's capacity.
- //!
- //! @return container's capacity.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- static size_type max_size() { return Capacity; }
-
- //! @brief Returns the number of stored elements.
- //!
- //! @return Number of elements contained in the container.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- size_type size() const { return m_size; }
-
- //! @brief Queries if the container contains elements.
- //!
- //! @return true if the number of elements contained in the
- //! container is equal to 0.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- bool empty() const { return 0 == m_size; }
-
- //! @brief Capacity is fixed so this call has no effects.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- void shrink_to_fit() {}
-
-private:
-
- // @par Throws
- // Nothing.
- // @par Complexity
- // Linear O(N).
- template <std::size_t C, typename S>
- void move_ctor_dispatch(static_vector<value_type, C, S> & other, boost::true_type /*use_memop*/)
- {
- ::memcpy(this->data(), other.data(), sizeof(Value) * other.m_size);
- m_size = other.m_size;
- other.m_size = 0;
- }
-
- // @par Throws
- // @li If boost::has_nothrow_move<Value>::value is true and Value's move constructor throws
- // @li If boost::has_nothrow_move<Value>::value is false and Value's copy constructor throws.
- // @par Complexity
- // Linear O(N).
- template <std::size_t C, typename S>
- void move_ctor_dispatch(static_vector<value_type, C, S> & other, boost::false_type /*use_memop*/)
- {
- namespace sv = static_vector_detail;
- sv::uninitialized_move_if_noexcept(other.begin(), other.end(), this->begin()); // may throw
- m_size = other.m_size;
- sv::destroy(other.begin(), other.end());
- other.m_size = 0;
- }
-
- // @par Throws
- // Nothing.
- // @par Complexity
- // Linear O(N).
- template <std::size_t C, typename S>
- void move_assign_dispatch(static_vector<value_type, C, S> & other, boost::true_type /*use_memop*/)
- {
- this->clear();
-
- ::memcpy(this->data(), other.data(), sizeof(Value) * other.m_size);
- boost::swap(m_size, other.m_size);
- }
-
- // @par Throws
- // @li If boost::has_nothrow_move<Value>::value is true and Value's move constructor or move assignment throws
- // @li If boost::has_nothrow_move<Value>::value is false and Value's copy constructor or move assignment throws.
- // @par Complexity
- // Linear O(N).
- template <std::size_t C, typename S>
- void move_assign_dispatch(static_vector<value_type, C, S> & other, boost::false_type /*use_memop*/)
- {
- namespace sv = static_vector_detail;
- if ( m_size <= static_cast<size_type>(other.size()) )
- {
- sv::move_if_noexcept(other.begin(), other.begin() + m_size, this->begin()); // may throw
- // TODO - perform uninitialized_copy first?
- sv::uninitialized_move_if_noexcept(other.begin() + m_size, other.end(), this->end()); // may throw
- }
- else
- {
- sv::move_if_noexcept(other.begin(), other.end(), this->begin()); // may throw
- sv::destroy(this->begin() + other.size(), this->end());
- }
- m_size = other.size(); // update end
-
- other.clear();
- }
-
- // @par Throws
- // Nothing.
- // @par Complexity
- // Linear O(N).
- template <std::size_t C, typename S>
- void swap_dispatch(static_vector<value_type, C, S> & other, boost::true_type const& /*use_optimized_swap*/)
- {
- typedef typename
- boost::mpl::if_c<
- Capacity < C,
- aligned_storage_type,
- typename static_vector<value_type, C, S>::aligned_storage_type
- >::type
- storage_type;
-
- storage_type temp;
- Value * temp_ptr = reinterpret_cast<Value*>(temp.address());
-
- ::memcpy(temp_ptr, this->data(), sizeof(Value) * this->size());
- ::memcpy(this->data(), other.data(), sizeof(Value) * other.size());
- ::memcpy(other.data(), temp_ptr, sizeof(Value) * this->size());
-
- boost::swap(m_size, other.m_size);
- }
-
- // @par Throws
- // If Value's move constructor or move assignment throws
- // but only if use_memop_in_swap_and_move is false_type - default.
- // @par Complexity
- // Linear O(N).
- template <std::size_t C, typename S>
- void swap_dispatch(static_vector<value_type, C, S> & other, boost::false_type const& /*use_optimized_swap*/)
- {
- namespace sv = static_vector_detail;
-
- typedef typename
- static_vector_detail::static_vector_traits<
- Value, Capacity, Strategy
- >::use_memop_in_swap_and_move use_memop_in_swap_and_move;
-
- if ( this->size() < other.size() )
- swap_dispatch_impl(this->begin(), this->end(), other.begin(), other.end(), use_memop_in_swap_and_move()); // may throw
- else
- swap_dispatch_impl(other.begin(), other.end(), this->begin(), this->end(), use_memop_in_swap_and_move()); // may throw
- boost::swap(m_size, other.m_size);
- }
-
- // @par Throws
- // Nothing.
- // @par Complexity
- // Linear O(N).
- void swap_dispatch_impl(iterator first_sm, iterator last_sm, iterator first_la, iterator last_la, boost::true_type const& /*use_memop*/)
- {
- //BOOST_ASSERT_MSG(std::distance(first_sm, last_sm) <= std::distance(first_la, last_la));
-
- namespace sv = static_vector_detail;
- for (; first_sm != last_sm ; ++first_sm, ++first_la)
- {
- boost::aligned_storage<
- sizeof(value_type),
- boost::alignment_of<value_type>::value
- > temp_storage;
- value_type * temp_ptr = reinterpret_cast<value_type*>(temp_storage.address());
-
- ::memcpy(temp_ptr, boost::addressof(*first_sm), sizeof(value_type));
- ::memcpy(boost::addressof(*first_sm), boost::addressof(*first_la), sizeof(value_type));
- ::memcpy(boost::addressof(*first_la), temp_ptr, sizeof(value_type));
- }
-
- ::memcpy(first_sm, first_la, sizeof(value_type) * std::distance(first_la, last_la));
- }
-
- // @par Throws
- // If Value's move constructor or move assignment throws.
- // @par Complexity
- // Linear O(N).
- void swap_dispatch_impl(iterator first_sm, iterator last_sm, iterator first_la, iterator last_la, boost::false_type const& /*use_memop*/)
- {
- //BOOST_ASSERT_MSG(std::distance(first_sm, last_sm) <= std::distance(first_la, last_la));
-
- namespace sv = static_vector_detail;
- for (; first_sm != last_sm ; ++first_sm, ++first_la)
- {
- //boost::swap(*first_sm, *first_la); // may throw
- value_type temp(boost::move(*first_sm)); // may throw
- *first_sm = boost::move(*first_la); // may throw
- *first_la = boost::move(temp); // may throw
- }
- sv::uninitialized_move(first_la, last_la, first_sm); // may throw
- sv::destroy(first_la, last_la);
- }
-
- // insert
-
- // @par Throws
- // If Value's move constructor or move assignment throws
- // or if Value's copy assignment throws.
- // @par Complexity
- // Linear O(N).
- template <typename V>
- iterator priv_insert(iterator position, V & value)
- {
- namespace sv = static_vector_detail;
-
- errh::check_iterator_end_eq(*this, position);
- errh::check_capacity(*this, m_size + 1); // may throw
-
- if ( position == this->end() )
- {
- sv::construct(position, value); // may throw
- ++m_size; // update end
- }
- else
- {
- // TODO - should following lines check for exception and revert to the old size?
-
- // TODO - should move be used only if it's nonthrowing?
- value_type & r = *(this->end() - 1);
- sv::construct(this->end(), boost::move(r)); // may throw
- ++m_size; // update end
- sv::move_backward(position, this->end() - 2, this->end() - 1); // may throw
- sv::assign(position, value); // may throw
- }
-
- return position;
- }
-
- // insert
-
- // @par Throws
- // If Value's move constructor, move assignment throws
- // or if Value's copy constructor or copy assignment throws.
- // @par Complexity
- // Linear O(N).
- template <typename Iterator>
- void insert_dispatch(iterator position, Iterator first, Iterator last, boost::random_access_traversal_tag const&)
- {
- BOOST_CONCEPT_ASSERT((boost_concepts::RandomAccessTraversal<Iterator>)); // Make sure you passed a RandomAccessIterator
-
- errh::check_iterator_end_eq(*this, position);
-
- typename boost::iterator_difference<Iterator>::type
- count = std::distance(first, last);
-
- errh::check_capacity(*this, m_size + count); // may throw
-
- if ( position == this->end() )
- {
- namespace sv = static_vector_detail;
-
- sv::uninitialized_copy(first, last, position); // may throw
- m_size += count; // update end
- }
- else
- {
- this->insert_in_the_middle(position, first, last, count); // may throw
- }
- }
-
- // @par Throws
- // If Value's move constructor, move assignment throws
- // or if Value's copy constructor or copy assignment throws.
- // @par Complexity
- // Linear O(N).
- template <typename Iterator, typename Traversal>
- void insert_dispatch(iterator position, Iterator first, Iterator last, Traversal const& /*not_random_access*/)
- {
- errh::check_iterator_end_eq(*this, position);
-
- if ( position == this->end() )
- {
- namespace sv = static_vector_detail;
-
- std::ptrdiff_t d = std::distance(position, this->begin() + Capacity);
- std::size_t count = sv::uninitialized_copy_s(first, last, position, d); // may throw
-
- errh::check_capacity(*this, count <= static_cast<std::size_t>(d) ? m_size + count : Capacity + 1); // may throw
-
- m_size += count;
- }
- else
- {
- typename boost::iterator_difference<Iterator>::type
- count = std::distance(first, last);
-
- errh::check_capacity(*this, m_size + count); // may throw
-
- this->insert_in_the_middle(position, first, last, count); // may throw
- }
- }
-
- // @par Throws
- // If Value's move constructor, move assignment throws
- // or if Value's copy constructor or copy assignment throws.
- // @par Complexity
- // Linear O(N).
- template <typename Iterator>
- void insert_in_the_middle(iterator position, Iterator first, Iterator last, difference_type count)
- {
- namespace sv = static_vector_detail;
-
- difference_type to_move = std::distance(position, this->end());
-
- // TODO - should following lines check for exception and revert to the old size?
-
- if ( count < to_move )
- {
- sv::uninitialized_move(this->end() - count, this->end(), this->end()); // may throw
- m_size += count; // update end
- sv::move_backward(position, position + to_move - count, this->end() - count); // may throw
- sv::copy(first, last, position); // may throw
- }
- else
- {
- Iterator middle_iter = first;
- std::advance(middle_iter, to_move);
-
- sv::uninitialized_copy(middle_iter, last, this->end()); // may throw
- m_size += count - to_move; // update end
- sv::uninitialized_move(position, position + to_move, position + count); // may throw
- m_size += to_move; // update end
- sv::copy(first, middle_iter, position); // may throw
- }
- }
-
- // assign
-
- // @par Throws
- // If Value's constructor or assignment taking dereferenced Iterator throws.
- // @par Complexity
- // Linear O(N).
- template <typename Iterator>
- void assign_dispatch(Iterator first, Iterator last, boost::random_access_traversal_tag const& /*not_random_access*/)
- {
- namespace sv = static_vector_detail;
-
- typename boost::iterator_difference<Iterator>::type
- s = std::distance(first, last);
-
- errh::check_capacity(*this, s); // may throw
-
- if ( m_size <= static_cast<size_type>(s) )
- {
- sv::copy(first, first + m_size, this->begin()); // may throw
- // TODO - perform uninitialized_copy first?
- sv::uninitialized_copy(first + m_size, last, this->end()); // may throw
- }
- else
- {
- sv::copy(first, last, this->begin()); // may throw
- sv::destroy(this->begin() + s, this->end());
- }
- m_size = s; // update end
- }
-
- // @par Throws
- // If Value's constructor or assignment taking dereferenced Iterator throws.
- // @par Complexity
- // Linear O(N).
- template <typename Iterator, typename Traversal>
- void assign_dispatch(Iterator first, Iterator last, Traversal const& /*not_random_access*/)
- {
- namespace sv = static_vector_detail;
-
- size_type s = 0;
- iterator it = this->begin();
-
- for ( ; it != this->end() && first != last ; ++it, ++first, ++s )
- *it = *first; // may throw
-
- sv::destroy(it, this->end());
-
- std::ptrdiff_t d = std::distance(it, this->begin() + Capacity);
- std::size_t count = sv::uninitialized_copy_s(first, last, it, d); // may throw
- s += count;
-
- errh::check_capacity(*this, count <= static_cast<std::size_t>(d) ? s : Capacity + 1); // may throw
-
- m_size = s; // update end
- }
-
- pointer ptr()
- {
- return pointer(static_cast<Value*>(m_storage.address()));
- }
-
- const_pointer ptr() const
- {
- return const_pointer(static_cast<const Value*>(m_storage.address()));
- }
-
- size_type m_size;
- aligned_storage_type m_storage;
-};
-
-#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-
-template<typename Value, typename Strategy>
-class static_vector<Value, 0, Strategy>
-{
- typedef static_vector_detail::static_vector_traits<
- Value, 0, Strategy
- > vt;
-
- typedef typename vt::size_type stored_size_type;
- typedef typename vt::error_handler errh;
-
-public:
- typedef typename vt::value_type value_type;
- typedef stored_size_type size_type;
- typedef typename vt::difference_type difference_type;
- typedef typename vt::pointer pointer;
- typedef typename vt::const_pointer const_pointer;
- typedef typename vt::reference reference;
- typedef typename vt::const_reference const_reference;
-
- typedef pointer iterator;
- typedef const_pointer const_iterator;
- typedef boost::reverse_iterator<iterator> reverse_iterator;
- typedef boost::reverse_iterator<const_iterator> const_reverse_iterator;
-
- // nothrow
- static_vector() {}
-
- // strong
- explicit static_vector(size_type count)
- {
- errh::check_capacity(*this, count); // may throw
- }
-
- // strong
- static_vector(size_type count, value_type const&)
- {
- errh::check_capacity(*this, count); // may throw
- }
-
- // strong
- static_vector(static_vector const& other)
- {
- //errh::check_capacity(*this, count);
- }
-
- // strong
- template <size_t C, typename S>
- static_vector(static_vector<value_type, C, S> const& other)
- {
- errh::check_capacity(*this, other.size()); // may throw
- }
-
- // strong
- template <typename Iterator>
- static_vector(Iterator first, Iterator last)
- {
- errh::check_capacity(*this, std::distance(first, last)); // may throw
- }
-
- // basic
- static_vector & operator=(static_vector const& other)
- {
- //errh::check_capacity(*this, other.size());
- return *this;
- }
-
- // basic
- template <size_t C, typename S>
- static_vector & operator=(static_vector<value_type, C, S> const& other)
- {
- errh::check_capacity(*this, other.size()); // may throw
- return *this;
- }
-
- // nothrow
- ~static_vector() {}
-
- // strong
- void resize(size_type count)
- {
- errh::check_capacity(*this, count); // may throw
- }
-
- // strong
- void resize(size_type count, value_type const&)
- {
- errh::check_capacity(*this, count); // may throw
- }
-
-
- // nothrow
- void reserve(size_type count)
- {
- errh::check_capacity(*this, count); // may throw
- }
-
- // strong
- void push_back(value_type const&)
- {
- errh::check_capacity(*this, 1); // may throw
- }
-
- // nothrow
- void pop_back()
- {
- errh::check_empty(*this);
- }
-
- // basic
- void insert(iterator position, value_type const&)
- {
- errh::check_iterator_end_eq(*this, position);
- errh::check_capacity(*this, 1); // may throw
- }
-
- // basic
- void insert(iterator position, size_type count, value_type const&)
- {
- errh::check_iterator_end_eq(*this, position);
- errh::check_capacity(*this, count); // may throw
- }
-
- // basic
- template <typename Iterator>
- void insert(iterator, Iterator first, Iterator last)
- {
- // TODO - add MPL_ASSERT, check if Iterator is really an iterator
- typedef typename boost::iterator_traversal<Iterator>::type traversal;
- errh::check_capacity(*this, std::distance(first, last)); // may throw
- }
-
- // basic
- void erase(iterator position)
- {
- errh::check_iterator_end_neq(*this, position);
- }
-
- // basic
- void erase(iterator first, iterator last)
- {
- errh::check_iterator_end_eq(*this, first);
- errh::check_iterator_end_eq(*this, last);
-
- //BOOST_ASSERT_MSG(0 <= n, "invalid range");
- }
-
- // basic
- template <typename Iterator>
- void assign(Iterator first, Iterator last)
- {
- // TODO - add MPL_ASSERT, check if Iterator is really an iterator
- typedef typename boost::iterator_traversal<Iterator>::type traversal;
- errh::check_capacity(*this, std::distance(first, last)); // may throw
- }
-
- // basic
- void assign(size_type count, value_type const&)
- {
- errh::check_capacity(*this, count); // may throw
- }
-
- // nothrow
- void clear() {}
-
- // strong
- reference at(size_type i)
- {
- errh::check_at(*this, i); // may throw
- return *(this->begin() + i);
- }
-
- // strong
- const_reference at(size_type i) const
- {
- errh::check_at(*this, i); // may throw
- return *(this->begin() + i);
- }
-
- // nothrow
- reference operator[](size_type i)
- {
- errh::check_operator_brackets(*this, i);
- return *(this->begin() + i);
- }
-
- // nothrow
- const_reference operator[](size_type i) const
- {
- errh::check_operator_brackets(*this, i);
- return *(this->begin() + i);
- }
-
- // nothrow
- reference front()
- {
- errh::check_empty(*this);
- return *(this->begin());
- }
-
- // nothrow
- const_reference front() const
- {
- errh::check_empty(*this);
- return *(this->begin());
- }
-
- // nothrow
- reference back()
- {
- errh::check_empty(*this);
- return *(this->end() - 1);
- }
-
- // nothrow
- const_reference back() const
- {
- errh::check_empty(*this);
- return *(this->end() - 1);
- }
-
- // nothrow
- Value * data() { return boost::addressof(*(this->ptr())); }
- const Value * data() const { return boost::addressof(*(this->ptr())); }
-
- // nothrow
- iterator begin() { return this->ptr(); }
- const_iterator begin() const { return this->ptr(); }
- const_iterator cbegin() const { return this->ptr(); }
- iterator end() { return this->begin(); }
- const_iterator end() const { return this->begin(); }
- const_iterator cend() const { return this->cbegin(); }
- // nothrow
- reverse_iterator rbegin() { return reverse_iterator(this->end()); }
- const_reverse_iterator rbegin() const { return reverse_iterator(this->end()); }
- const_reverse_iterator crbegin() const { return reverse_iterator(this->end()); }
- reverse_iterator rend() { return reverse_iterator(this->begin()); }
- const_reverse_iterator rend() const { return reverse_iterator(this->begin()); }
- const_reverse_iterator crend() const { return reverse_iterator(this->begin()); }
-
- // nothrow
- size_type capacity() const { return 0; }
- size_type max_size() const { return 0; }
- size_type size() const { return 0; }
- bool empty() const { return true; }
- void shrink_to_fit() {}
-
-private:
-
- pointer ptr()
- {
- return pointer(reinterpret_cast<Value*>(this));
- }
-
- const_pointer ptr() const
- {
- return const_pointer(reinterpret_cast<const Value*>(this));
- }
-};
-
-#endif // !BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION && !BOOST_CONTAINER_DOXYGEN_INVOKED
-
-//! @brief Checks if contents of two static_vectors are equal.
-//!
-//! @ingroup static_vector_non_member
-//!
-//! @param x The first static_vector.
-//! @param y The second static_vector.
-//!
-//! @return \c true if containers have the same size and elements in both containers are equal.
-//!
-//! @par Complexity
-//! Linear O(N).
-template<typename V, std::size_t C1, typename S1, std::size_t C2, typename S2>
-bool operator== (static_vector<V, C1, S1> const& x, static_vector<V, C2, S2> const& y)
-{
- return x.size() == y.size() && std::equal(x.begin(), x.end(), y.begin());
-}
-
-//! @brief Checks if contents of two static_vectors are not equal.
-//!
-//! @ingroup static_vector_non_member
-//!
-//! @param x The first static_vector.
-//! @param y The second static_vector.
-//!
-//! @return \c true if containers have different size or elements in both containers are not equal.
-//!
-//! @par Complexity
-//! Linear O(N).
-template<typename V, std::size_t C1, typename S1, std::size_t C2, typename S2>
-bool operator!= (static_vector<V, C1, S1> const& x, static_vector<V, C2, S2> const& y)
-{
- return !(x==y);
-}
-
-//! @brief Lexicographically compares static_vectors.
-//!
-//! @ingroup static_vector_non_member
-//!
-//! @param x The first static_vector.
-//! @param y The second static_vector.
-//!
-//! @return \c true if x compares lexicographically less than y.
-//!
-//! @par Complexity
-//! Linear O(N).
-template<typename V, std::size_t C1, typename S1, std::size_t C2, typename S2>
-bool operator< (static_vector<V, C1, S1> const& x, static_vector<V, C2, S2> const& y)
-{
- return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end());
-}
-
-//! @brief Lexicographically compares static_vectors.
-//!
-//! @ingroup static_vector_non_member
-//!
-//! @param x The first static_vector.
-//! @param y The second static_vector.
-//!
-//! @return \c true if y compares lexicographically less than x.
-//!
-//! @par Complexity
-//! Linear O(N).
-template<typename V, std::size_t C1, typename S1, std::size_t C2, typename S2>
-bool operator> (static_vector<V, C1, S1> const& x, static_vector<V, C2, S2> const& y)
-{
- return y<x;
-}
-
-//! @brief Lexicographically compares static_vectors.
-//!
-//! @ingroup static_vector_non_member
-//!
-//! @param x The first static_vector.
-//! @param y The second static_vector.
-//!
-//! @return \c true if y don't compare lexicographically less than x.
-//!
-//! @par Complexity
-//! Linear O(N).
-template<typename V, std::size_t C1, typename S1, std::size_t C2, typename S2>
-bool operator<= (static_vector<V, C1, S1> const& x, static_vector<V, C2, S2> const& y)
-{
- return !(y<x);
-}
-
-//! @brief Lexicographically compares static_vectors.
-//!
-//! @ingroup static_vector_non_member
-//!
-//! @param x The first static_vector.
-//! @param y The second static_vector.
-//!
-//! @return \c true if x don't compare lexicographically less than y.
-//!
-//! @par Complexity
-//! Linear O(N).
-template<typename V, std::size_t C1, typename S1, std::size_t C2, typename S2>
-bool operator>= (static_vector<V, C1, S1> const& x, static_vector<V, C2, S2> const& y)
-{
- return !(x<y);
-}
-
-//! @brief Swaps contents of two static_vectors.
-//!
-//! This function calls static_vector::swap().
-//!
-//! @ingroup static_vector_non_member
-//!
-//! @param x The first static_vector.
-//! @param y The second static_vector.
-//!
-//! @par Complexity
-//! Linear O(N).
-template<typename V, std::size_t C1, typename S1, std::size_t C2, typename S2>
-inline void swap(static_vector<V, C1, S1> & x, static_vector<V, C2, S2> & y)
-{
- x.swap(y);
-}
-
-}} // namespace boost::container
-
-#include <boost/container/detail/config_end.hpp>
-
-#endif // BOOST_CONTAINER_STATIC_VECTOR_HPP

Copied: sandbox/varray/boost/container/varray.hpp (from r82619, /sandbox/varray/boost/container/static_vector.hpp)
==============================================================================
--- /sandbox/varray/boost/container/static_vector.hpp (original)
+++ sandbox/varray/boost/container/varray.hpp 2013-01-26 22:36:10 EST (Sat, 26 Jan 2013)
@@ -1,2284 +1,102 @@
-// Boost.Container static_vector
+// Boost.Container varray
 //
-// Copyright (c) 2012 Adam Wulkiewicz, Lodz, Poland.
-// Copyright (c) 2011-2012 Andrew Hundt.
+// Copyright (c) 2012-2013 Adam Wulkiewicz, Lodz, Poland.
+// Copyright (c) 2011-2013 Andrew Hundt.
 //
 // 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)
 
-#ifndef BOOST_CONTAINER_STATIC_VECTOR_HPP
-#define BOOST_CONTAINER_STATIC_VECTOR_HPP
+#ifndef BOOST_CONTAINER_VARRAY_HPP
+#define BOOST_CONTAINER_VARRAY_HPP
 
-#if (defined _MSC_VER) && (_MSC_VER >= 1200)
-# pragma once
-#endif
-
-#include <boost/container/detail/config_begin.hpp>
-#include <boost/container/detail/workaround.hpp>
-#include <boost/container/detail/preprocessor.hpp>
-
-#include <boost/container/detail/static_vector_util.hpp>
-#include <boost/container/detail/static_vector_concept.hpp>
-#include <boost/iterator/iterator_concepts.hpp>
-
-#ifndef BOOST_NO_EXCEPTIONS
-#include <stdexcept>
-#endif // BOOST_NO_EXCEPTIONS
-
-#include <boost/assert.hpp>
-#include <boost/config.hpp>
-#include <boost/swap.hpp>
-#include <boost/integer.hpp>
-
-#include <boost/mpl/assert.hpp>
-
-#include <boost/type_traits/is_unsigned.hpp>
-#include <boost/type_traits/alignment_of.hpp>
-#include <boost/type_traits/aligned_storage.hpp>
-
-// TODO - use std::reverse_iterator and std::iterator_traits
-// instead Boost.Iterator to remove dependency?
-// or boost/detail/iterator.hpp ?
-#include <boost/iterator/reverse_iterator.hpp>
-
-/**
- * @defgroup static_vector_non_member static_vector non-member functions (boost::container::)
- */
+#include <boost/container/detail/varray.hpp>
 
 namespace boost { namespace container {
 
-// Forward declaration
-template <typename Value, std::size_t Capacity, typename Strategy>
-class static_vector;
-
-namespace strategy {
-
-// TODO: Improve error messages
-// possibly include N in the strategy, and provide size as an optoinal allocate_failed parameter?
-// Example of current error with reserve(4) when capacity is 3:
-// "boost/container/static_vector.hpp(66): size can't exceed the capacity"
-// Could say
-// "cannot reserve(4) due to fixed capacity of 3 elements"
-
-//! @brief The default strategy.
-//!
-//! @tparam Value Type of element stored in the container.
-template <typename Value>
-struct def
-{
- typedef Value value_type;
- typedef std::size_t size_type;
- typedef std::ptrdiff_t difference_type;
- typedef Value* pointer;
- typedef const Value* const_pointer;
- typedef Value& reference;
- typedef const Value& const_reference;
-
- static void allocate_failed()
- {
- BOOST_ASSERT_MSG(false, "size can't exceed the capacity");
- }
-};
-
-//! @brief The strategy adapting info from passed Allocator.
-//!
-//! This strategy defines the same types that are defined in the Allocator.
-//!
-//! @tparam Allocator The Allocator which will be adapted.
-template <typename Allocator>
-struct allocator_adaptor
-{
- typedef typename Allocator::value_type value_type;
- typedef typename Allocator::size_type size_type;
- typedef typename Allocator::difference_type difference_type;
- typedef typename Allocator::pointer pointer;
- typedef typename Allocator::const_pointer const_pointer;
- typedef typename Allocator::reference reference;
- typedef typename Allocator::const_reference const_reference;
-
- static void allocate_failed()
- {
- BOOST_ASSERT_MSG(false, "size can't exceed the capacity");
- }
-};
-
-} // namespace strategy
-
-namespace static_vector_detail {
-
-struct default_error_handler
-{
- template <typename V, std::size_t Capacity, typename S>
- static void check_capacity(container::static_vector<V, Capacity, S> const&, std::size_t s)
- {
- if ( Capacity < s )
- S::allocate_failed();
- }
-
- template <typename V, std::size_t C, typename S>
- static void check_at(container::static_vector<V, C, S> const& v,
- typename container::static_vector<V, C, S>::size_type i)
- {
-// TODO - use BOOST_THROW_EXCEPTION here?
-#ifndef BOOST_NO_EXCEPTIONS
- if ( v.size() <= i )
- throw std::out_of_range("index out of bounds");
-#else // BOOST_NO_EXCEPTIONS
- BOOST_ASSERT_MSG(i < v.size(), "index out of bounds");
-#endif // BOOST_NO_EXCEPTIONS
- }
-
- template <typename V, std::size_t C, typename S>
- static void check_operator_brackets(container::static_vector<V, C, S> const& v,
- typename container::static_vector<V, C, S>::size_type i)
- {
- BOOST_ASSERT_MSG(i < v.size(), "index out of bounds");
- }
-
- template <typename V, std::size_t C, typename S>
- static void check_empty(container::static_vector<V, C, S> const& v)
- {
- BOOST_ASSERT_MSG(0 < v.size(), "the container is empty");
- }
-
- template <typename V, std::size_t C, typename S>
- static void check_iterator_end_neq(container::static_vector<V, C, S> const& v,
- typename container::static_vector<V, C, S>::const_iterator position)
- {
- BOOST_ASSERT_MSG(v.begin() <= position && position < v.end(), "iterator out of bounds");
- }
-
- template <typename V, std::size_t C, typename S>
- static void check_iterator_end_eq(container::static_vector<V, C, S> const& v,
- typename container::static_vector<V, C, S>::const_iterator position)
- {
- BOOST_ASSERT_MSG(v.begin() <= position && position <= v.end(), "iterator out of bounds");
- }
-};
-
-template <typename Value, std::size_t Capacity, typename Strategy>
-struct static_vector_traits
-{
- typedef typename Strategy::value_type value_type;
- typedef typename Strategy::size_type size_type;
- typedef typename Strategy::difference_type difference_type;
- typedef typename Strategy::pointer pointer;
- typedef typename Strategy::const_pointer const_pointer;
- typedef typename Strategy::reference reference;
- typedef typename Strategy::const_reference const_reference;
-
- typedef default_error_handler error_handler;
-
- typedef boost::false_type use_memop_in_swap_and_move;
- typedef boost::false_type use_optimized_swap;
-};
-
-} // namespace static_vector_detail
-
 /**
- * @brief A hybrid of \c boost::container::vector and \c boost::array with fixed capacity.
+ * @brief A variable-size array container with fixed capacity.
  *
- * static_vector is a sequence container like boost::container::vector with contiguous storage that can
+ * varray is a sequence container like boost::container::vector with contiguous storage that can
  * change in size, along with the static allocation, low overhead, and fixed capacity of boost::array.
  *
- * A static_vector is a sequence that supports random access to elements, constant time insertion and
+ * A varray is a sequence that supports random access to elements, constant time insertion and
  * removal of elements at the end, and linear time insertion and removal of elements at the beginning or
- * in the middle. The number of elements in a static_vector may vary dynamically up to a fixed capacity
+ * in the middle. The number of elements in a varray may vary dynamically up to a fixed capacity
  * because elements are stored within the object itself similarly to an array. However, objects are
- * initialized as they are inserted into static_vector unlike C arrays or std::array which must construct
- * all elements on instantiation. The behavior of static_vector enables the use of statically allocated
+ * initialized as they are inserted into varray unlike C arrays or std::array which must construct
+ * all elements on instantiation. The behavior of varray enables the use of statically allocated
  * elements in cases with complex object lifetime requirements that would otherwise not be trivially
  * possible.
  *
  * @par Error Handling
  * Insertion beyond the capacity and out of bounds errors result in undefined behavior unless
- * otherwise specified. In this respect if size() == capacity(), then static_vector::push_back()
+ * otherwise specified. In this respect if size() == capacity(), then varray::push_back()
  * behaves like std::vector pop_front() if size() == empty(). The reason for this difference
- * is because unlike vectors, static_vector does not perform allocation.
+ * is because unlike vectors, varray does not perform allocation.
  *
  * @par Advanced Usage
  * Error handling behavior can be modified to more closely match std::vector exception behavior
- * when exceeding bounds by providing an alternate Strategy and static_vector_traits instantiation.
+ * when exceeding bounds by providing an alternate Strategy and varray_traits instantiation.
  *
  * @tparam Value The type of element that will be stored.
- * @tparam Capacity The maximum number of elements static_vector can store, fixed at compile time.
+ * @tparam Capacity The maximum number of elements varray can store, fixed at compile time.
  * @tparam Strategy Defines the public typedefs and error handlers,
  * implements StaticVectorStrategy and has some similarities
  * to an Allocator.
  */
-template <typename Value, std::size_t Capacity, typename Strategy = strategy::def<Value> >
-class static_vector
+template <typename Value, std::size_t Capacity>
+class varray
+ : public container_detail::varray<Value, Capacity>
 {
- typedef static_vector_detail::static_vector_traits<
- Value, Capacity, Strategy
- > vt;
-
- typedef typename vt::error_handler errh;
-
- BOOST_MPL_ASSERT_MSG(
- ( boost::is_unsigned<typename vt::size_type>::value &&
- sizeof(typename boost::uint_value_t<Capacity>::least) <= sizeof(typename vt::size_type) ),
- SIZE_TYPE_IS_TOO_SMALL_FOR_SPECIFIED_CAPACITY,
- (static_vector)
- );
-
- BOOST_CONCEPT_ASSERT((concept::StaticVectorStrategy<Strategy>));
+ typedef container_detail::varray<Value, Capacity> base_t;
 
- typedef boost::aligned_storage<
- sizeof(Value[Capacity]),
- boost::alignment_of<Value[Capacity]>::value
- > aligned_storage_type;
+ BOOST_COPYABLE_AND_MOVABLE(varray)
 
- template <typename V, std::size_t C, typename S>
- friend class static_vector;
-
- BOOST_COPYABLE_AND_MOVABLE(static_vector)
-
-#ifdef BOOST_NO_RVALUE_REFERENCES
 public:
- template <std::size_t C, typename S>
- static_vector & operator=(static_vector<Value, C, S> & sv)
- {
- typedef static_vector<Value, C, S> other;
- this->operator=(static_cast<const ::boost::rv<other> &>(const_cast<const other &>(sv)));
- return *this;
- }
-#endif
-
-public:
- //! @brief The type of elements stored in the container.
- typedef typename vt::value_type value_type;
- //! @brief The unsigned integral type used by the container.
- typedef typename vt::size_type size_type;
- //! @brief The pointers difference type.
- typedef typename vt::difference_type difference_type;
- //! @brief The pointer type.
- typedef typename vt::pointer pointer;
- //! @brief The const pointer type.
- typedef typename vt::const_pointer const_pointer;
- //! @brief The value reference type.
- typedef typename vt::reference reference;
- //! @brief The value const reference type.
- typedef typename vt::const_reference const_reference;
-
- //! @brief The iterator type.
- typedef pointer iterator;
- //! @brief The const iterator type.
- typedef const_pointer const_iterator;
- //! @brief The reverse iterator type.
- typedef boost::reverse_iterator<iterator> reverse_iterator;
- //! @brief The const reverse iterator.
- typedef boost::reverse_iterator<const_iterator> const_reverse_iterator;
-
- //! @brief The type of a strategy used by the static_vector.
- typedef Strategy strategy_type;
-
- //! @brief Constructs an empty static_vector.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- static_vector()
- : m_size(0)
- {}
-
- //! @pre <tt>count <= capacity()</tt>
- //!
- //! @brief Constructs a static_vector containing count default constructed Values.
- //!
- //! @param count The number of values which will be contained in the container.
- //!
- //! @par Throws
- //! If Value's default constructor throws.
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Linear O(N).
- explicit static_vector(size_type count)
- : m_size(0)
- {
- this->resize(count); // may throw
- }
-
- //! @pre <tt>count <= capacity()</tt>
- //!
- //! @brief Constructs a static_vector containing count copies of value.
- //!
- //! @param count The number of copies of a values that will be contained in the container.
- //! @param value The value which will be used to copy construct values.
- //!
- //! @par Throws
- //! If Value's copy constructor throws.
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Linear O(N).
- static_vector(size_type count, value_type const& value)
- : m_size(0)
- {
- this->resize(count, value); // may throw
- }
+ typedef typename base_t::value_type value_type;
+ typedef typename base_t::size_type size_type;
 
- //! @pre
- //! @li <tt>distance(first, last) <= capacity()</tt>
- //! @li Iterator must meet the \c ForwardTraversalIterator concept.
- //!
- //! @brief Constructs a static_vector containing copy of a range <tt>[first, last)</tt>.
- //!
- //! @param first The iterator to the first element in range.
- //! @param last The iterator to the one after the last element in range.
- //!
- //! @par Throws
- //! If Value's constructor taking a dereferenced Iterator throws.
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Linear O(N).
+ varray() : base_t() {}
+ explicit varray(size_type count) : base_t(count) {}
+ varray(size_type count, value_type const& value) : base_t(count, value) {}
     template <typename Iterator>
- static_vector(Iterator first, Iterator last)
- : m_size(0)
- {
- BOOST_CONCEPT_ASSERT((boost_concepts::ForwardTraversal<Iterator>)); // Make sure you passed a ForwardIterator
-
- this->assign(first, last); // may throw
- }
-
- //! @brief Constructs a copy of other static_vector.
- //!
- //! @param other The static_vector which content will be copied to this one.
- //!
- //! @par Throws
- //! If Value's copy constructor throws.
- //!
- //! @par Complexity
- //! Linear O(N).
- static_vector(static_vector const& other)
- : m_size(other.size())
- {
- namespace sv = static_vector_detail;
- sv::uninitialized_copy(other.begin(), other.end(), this->begin()); // may throw
- }
-
- //! @pre <tt>other.size() <= capacity()</tt>.
- //!
- //! @brief Constructs a copy of other static_vector.
- //!
- //! @param other The static_vector which content will be copied to this one.
- //!
- //! @par Throws
- //! If Value's copy constructor throws.
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Linear O(N).
- template <std::size_t C, typename S>
- static_vector(static_vector<value_type, C, S> const& other)
- : m_size(other.size())
- {
- errh::check_capacity(*this, other.size()); // may throw
-
- namespace sv = static_vector_detail;
- sv::uninitialized_copy(other.begin(), other.end(), this->begin()); // may throw
- }
+ varray(Iterator first, Iterator last) : base_t(first, last) {}
 
- //! @brief Copy assigns Values stored in the other static_vector to this one.
- //!
- //! @param other The static_vector which content will be copied to this one.
- //!
- //! @par Throws
- //! If Value's copy constructor or copy assignment throws.
- //!
- //! @par Complexity
- //! Linear O(N).
- static_vector & operator=(BOOST_COPY_ASSIGN_REF(static_vector) other)
- {
- this->assign(other.begin(), other.end()); // may throw
+ varray(varray const& other) : base_t(other) {}
+ template <std::size_t C>
+ varray(varray<value_type, C> const& other) : base_t(other) {}
 
- return *this;
- }
-
- //! @pre <tt>other.size() <= capacity()</tt>
- //!
- //! @brief Copy assigns Values stored in the other static_vector to this one.
- //!
- //! @param other The static_vector which content will be copied to this one.
- //!
- //! @par Throws
- //! If Value's copy constructor or copy assignment throws.
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Linear O(N).
- template <std::size_t C, typename S>
+ varray & operator=(BOOST_COPY_ASSIGN_REF(varray) other) { base_t::operator=(other); return *this; }
+ template <std::size_t C>
 // TEMPORARY WORKAROUND
 #if defined(BOOST_NO_RVALUE_REFERENCES)
- static_vector & operator=(::boost::rv< static_vector<value_type, C, S> > const& other)
+ varray & operator=(::boost::rv< varray<value_type, C> > const& other)
 #else
- static_vector & operator=(static_vector<value_type, C, S> const& other)
+ varray & operator=(varray<value_type, C> const& other)
 #endif
- {
- this->assign(other.begin(), other.end()); // may throw
-
- return *this;
- }
-
- //! @brief Move constructor. Moves Values stored in the other static_vector to this one.
- //!
- //! @param other The static_vector which content will be moved to this one.
- //!
- //! @par Throws
- //! @li If \c boost::has_nothrow_move<Value>::value is \c true and Value's move constructor throws.
- //! @li If \c boost::has_nothrow_move<Value>::value is \c false and Value's copy constructor throws.
- //! @internal
- //! @li It throws only if \c use_memop_in_swap_and_move is \c false_type - default.
- //! @endinternal
- //!
- //! @par Complexity
- //! Linear O(N).
- static_vector(BOOST_RV_REF(static_vector) other)
- {
- typedef typename
- static_vector_detail::static_vector_traits<
- Value, Capacity, Strategy
- >::use_memop_in_swap_and_move use_memop_in_swap_and_move;
-
- this->move_ctor_dispatch(other, use_memop_in_swap_and_move());
- }
-
- //! @pre <tt>other.size() <= capacity()</tt>
- //!
- //! @brief Move constructor. Moves Values stored in the other static_vector to this one.
- //!
- //! @param other The static_vector which content will be moved to this one.
- //!
- //! @par Throws
- //! @li If \c boost::has_nothrow_move<Value>::value is \c true and Value's move constructor throws.
- //! @li If \c boost::has_nothrow_move<Value>::value is \c false and Value's copy constructor throws.
- //! @internal
- //! @li It throws only if \c use_memop_in_swap_and_move is false_type - default.
- //! @endinternal
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Linear O(N).
- template <std::size_t C, typename S>
- static_vector(BOOST_RV_REF_3_TEMPL_ARGS(static_vector, value_type, C, S) other)
- : m_size(other.m_size)
- {
- errh::check_capacity(*this, other.size()); // may throw
-
- typedef typename
- static_vector_detail::static_vector_traits<
- Value, Capacity, Strategy
- >::use_memop_in_swap_and_move use_memop_in_swap_and_move;
-
- this->move_ctor_dispatch(other, use_memop_in_swap_and_move());
- }
-
- //! @brief Move assignment. Moves Values stored in the other static_vector to this one.
- //!
- //! @param other The static_vector which content will be moved to this one.
- //!
- //! @par Throws
- //! @li If \c boost::has_nothrow_move<Value>::value is \c true and Value's move constructor or move assignment throws.
- //! @li If \c boost::has_nothrow_move<Value>::value is \c false and Value's copy constructor or copy assignment throws.
- //! @internal
- //! @li It throws only if \c use_memop_in_swap_and_move is \c false_type - default.
- //! @endinternal
- //!
- //! @par Complexity
- //! Linear O(N).
- static_vector & operator=(BOOST_RV_REF(static_vector) other)
- {
- if ( &other == this )
- return *this;
-
- typedef typename
- static_vector_detail::static_vector_traits<
- Value, Capacity, Strategy
- >::use_memop_in_swap_and_move use_memop_in_swap_and_move;
-
- this->move_assign_dispatch(other, use_memop_in_swap_and_move());
-
- return *this;
- }
-
- //! @pre <tt>other.size() <= capacity()</tt>
- //!
- //! @brief Move assignment. Moves Values stored in the other static_vector to this one.
- //!
- //! @param other The static_vector which content will be moved to this one.
- //!
- //! @par Throws
- //! @li If \c boost::has_nothrow_move<Value>::value is \c true and Value's move constructor or move assignment throws.
- //! @li If \c boost::has_nothrow_move<Value>::value is \c false and Value's copy constructor or copy assignment throws.
- //! @internal
- //! @li It throws only if \c use_memop_in_swap_and_move is \c false_type - default.
- //! @endinternal
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Linear O(N).
- template <std::size_t C, typename S>
- static_vector & operator=(BOOST_RV_REF_3_TEMPL_ARGS(static_vector, value_type, C, S) other)
- {
- errh::check_capacity(*this, other.size()); // may throw
-
- typedef typename
- static_vector_detail::static_vector_traits<
- Value, Capacity, Strategy
- >::use_memop_in_swap_and_move use_memop_in_swap_and_move;
-
- this->move_assign_dispatch(other, use_memop_in_swap_and_move());
-
- return *this;
- }
-
- //! @brief Destructor. Destroys Values stored in this container.
- //!
- //! @par Throws
- //! Nothing
- //!
- //! @par Complexity
- //! Linear O(N).
- ~static_vector()
- {
- namespace sv = static_vector_detail;
- sv::destroy(this->begin(), this->end());
- }
-
- //! @brief Swaps contents of the other static_vector and this one.
- //!
- //! @param other The static_vector which content will be swapped with this one's content.
- //!
- //! @par Throws
- //! @li If \c boost::has_nothrow_move<Value>::value is \c true and Value's move constructor or move assignment throws,
- //! @li If \c boost::has_nothrow_move<Value>::value is \c false and Value's copy constructor or copy assignment throws,
- //! @internal
- //! @li It throws only if \c use_memop_in_swap_and_move and \c use_optimized_swap are \c false_type - default.
- //! @endinternal
- //!
- //! @par Complexity
- //! Linear O(N).
- void swap(static_vector & other)
- {
- typedef typename
- static_vector_detail::static_vector_traits<
- Value, Capacity, Strategy
- >::use_optimized_swap use_optimized_swap;
-
- this->swap_dispatch(other, use_optimized_swap());
- }
-
- //! @pre <tt>other.size() <= capacity() && size() <= other.capacity()</tt>
- //!
- //! @brief Swaps contents of the other static_vector and this one.
- //!
- //! @param other The static_vector which content will be swapped with this one's content.
- //!
- //! @par Throws
- //! @li If \c boost::has_nothrow_move<Value>::value is \c true and Value's move constructor or move assignment throws,
- //! @li If \c boost::has_nothrow_move<Value>::value is \c false and Value's copy constructor or copy assignment throws,
- //! @internal
- //! @li It throws only if \c use_memop_in_swap_and_move and \c use_optimized_swap are \c false_type - default.
- //! @endinternal
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Linear O(N).
- template <std::size_t C, typename S>
- void swap(static_vector<value_type, C, S> & other)
- {
- errh::check_capacity(*this, other.size());
- errh::check_capacity(other, this->size());
-
- typedef typename
- static_vector_detail::static_vector_traits<
- Value, Capacity, Strategy
- >::use_optimized_swap use_optimized_swap;
-
- this->swap_dispatch(other, use_optimized_swap());
- }
-
- //! @pre <tt>count <= capacity()</tt>
- //!
- //! @brief Inserts or erases elements at the end such that
- //! the size becomes count. New elements are default constructed.
- //!
- //! @param count The number of elements which will be stored in the container.
- //!
- //! @par Throws
- //! If Value's default constructor throws.
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Linear O(N).
- void resize(size_type count)
- {
- namespace sv = static_vector_detail;
-
- if ( count < m_size )
- {
- sv::destroy(this->begin() + count, this->end());
- }
- else
- {
- errh::check_capacity(*this, count); // may throw
-
- sv::uninitialized_fill(this->end(), this->begin() + count); // may throw
- }
- m_size = count; // update end
- }
-
- //! @pre <tt>count <= capacity()</tt>
- //!
- //! @brief Inserts or erases elements at the end such that
- //! the size becomes count. New elements are copy constructed from value.
- //!
- //! @param count The number of elements which will be stored in the container.
- //! @param value The value used to copy construct the new element.
- //!
- //! @par Throws
- //! If Value's copy constructor throws.
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Linear O(N).
- void resize(size_type count, value_type const& value)
- {
- if ( count < m_size )
- {
- namespace sv = static_vector_detail;
- sv::destroy(this->begin() + count, this->end());
- }
- else
- {
- errh::check_capacity(*this, count); // may throw
-
- std::uninitialized_fill(this->end(), this->begin() + count, value); // may throw
- }
- m_size = count; // update end
- }
-
- //! @pre <tt>count <= capacity()</tt>
- //!
- //! @brief This call has no effect because the Capacity of this container is constant.
- //!
- //! @param count The number of elements which the container should be able to contain.
- //!
- //! @par Throws
- //! Nothing.
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Linear O(N).
- void reserve(size_type count)
- {
- errh::check_capacity(*this, count); // may throw
- }
-
- //! @pre <tt>size() < capacity()</tt>
- //!
- //! @brief Adds a copy of value at the end.
- //!
- //! @param value The value used to copy construct the new element.
- //!
- //! @par Throws
- //! If Value's copy constructor throws.
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Constant O(1).
- void push_back(value_type const& value)
- {
- errh::check_capacity(*this, m_size + 1); // may throw
-
- namespace sv = static_vector_detail;
- sv::construct(this->end(), value); // may throw
- ++m_size; // update end
- }
-
- //! @pre <tt>size() < capacity()</tt>
- //!
- //! @brief Moves value to the end.
- //!
- //! @param value The value to move construct the new element.
- //!
- //! @par Throws
- //! If Value's move constructor throws.
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Constant O(1).
- void push_back(BOOST_RV_REF(value_type) value)
- {
- errh::check_capacity(*this, m_size + 1); // may throw
-
- namespace sv = static_vector_detail;
- sv::construct(this->end(), value); // may throw
- ++m_size; // update end
- }
-
- //! @pre <tt>!empty()</tt>
- //!
- //! @brief Destroys last value and decreases the size.
- //!
- //! @par Throws
- //! Nothing by default.
- //!
- //! @par Complexity
- //! Constant O(1).
- void pop_back()
- {
- errh::check_empty(*this);
-
- namespace sv = static_vector_detail;
- sv::destroy(this->end() - 1);
- --m_size; // update end
- }
-
- //! @pre
- //! @li \c position must be a valid iterator of \c *this in range <tt>[begin(), end()]</tt>.
- //! @li <tt>size() < capacity()</tt>
- //!
- //! @brief Inserts a copy of element at position.
- //!
- //! @param position The position at which the new value will be inserted.
- //! @param value The value used to copy construct the new element.
- //!
- //! @par Throws
- //! @li If Value's copy constructor or copy assignment throws
- //! @li If Value's move constructor or move assignment throws.
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Constant or linear.
- iterator insert(iterator position, value_type const& value)
- {
- return this->priv_insert(position, value);
- }
-
- //! @pre
- //! @li \c position must be a valid iterator of \c *this in range <tt>[begin(), end()]</tt>.
- //! @li <tt>size() < capacity()</tt>
- //!
- //! @brief Inserts a move-constructed element at position.
- //!
- //! @param position The position at which the new value will be inserted.
- //! @param value The value used to move construct the new element.
- //!
- //! @par Throws
- //! If Value's move constructor or move assignment throws.
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Constant or linear.
- iterator insert(iterator position, BOOST_RV_REF(value_type) value)
- {
- return this->priv_insert(position, value);
- }
-
- //! @pre
- //! @li \c position must be a valid iterator of \c *this in range <tt>[begin(), end()]</tt>.
- //! @li <tt>size() + count <= capacity()</tt>
- //!
- //! @brief Inserts a count copies of value at position.
- //!
- //! @param position The position at which new elements will be inserted.
- //! @param count The number of new elements which will be inserted.
- //! @param value The value used to copy construct new elements.
- //!
- //! @par Throws
- //! @li If Value's copy constructor or copy assignment throws.
- //! @li If Value's move constructor or move assignment throws.
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Linear O(N).
- iterator insert(iterator position, size_type count, value_type const& value)
- {
- errh::check_iterator_end_eq(*this, position);
- errh::check_capacity(*this, m_size + count); // may throw
-
- if ( position == this->end() )
- {
- std::uninitialized_fill(position, position + count, value); // may throw
- m_size += count; // update end
- }
- else
- {
- namespace sv = static_vector_detail;
-
- difference_type to_move = std::distance(position, this->end());
-
- // TODO - should following lines check for exception and revert to the old size?
-
- if ( count < static_cast<size_type>(to_move) )
- {
- sv::uninitialized_move(this->end() - count, this->end(), this->end()); // may throw
- m_size += count; // update end
- sv::move_backward(position, position + to_move - count, this->end() - count); // may throw
- std::fill_n(position, count, value); // may throw
- }
- else
- {
- std::uninitialized_fill(this->end(), position + count, value); // may throw
- m_size += count - to_move; // update end
- sv::uninitialized_move(position, position + to_move, position + count); // may throw
- m_size += to_move; // update end
- std::fill_n(position, to_move, value); // may throw
- }
- }
-
- return position;
- }
-
- //! @pre
- //! @li \c position must be a valid iterator of \c *this in range <tt>[begin(), end()]</tt>.
- //! @li <tt>distance(first, last) <= capacity()</tt>
- //! @li \c Iterator must meet the \c ForwardTraversalIterator concept.
- //!
- //! @brief Inserts a copy of a range <tt>[first, last)</tt> at position.
- //!
- //! @param position The position at which new elements will be inserted.
- //! @param first The iterator to the first element of a range used to construct new elements.
- //! @param last The iterator to the one after the last element of a range used to construct new elements.
- //!
- //! @par Throws
- //! @li If Value's constructor and assignment taking a dereferenced \c Iterator.
- //! @li If Value's move constructor or move assignment throws.
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Linear O(N).
- template <typename Iterator>
- iterator insert(iterator position, Iterator first, Iterator last)
- {
- BOOST_CONCEPT_ASSERT((boost_concepts::ForwardTraversal<Iterator>)); // Make sure you passed a ForwardIterator
-
- typedef typename boost::iterator_traversal<Iterator>::type traversal;
- this->insert_dispatch(position, first, last, traversal());
-
- return position;
- }
-
- //! @pre \c position must be a valid iterator of \c *this in range <tt>[begin(), end())</tt>
- //!
- //! @brief Erases Value from position.
- //!
- //! @param position The position of the element which will be erased from the container.
- //!
- //! @par Throws
- //! If Value's move assignment throws.
- //!
- //! @par Complexity
- //! Linear O(N).
- iterator erase(iterator position)
- {
- namespace sv = static_vector_detail;
-
- errh::check_iterator_end_neq(*this, position);
-
- //TODO - add empty check?
- //errh::check_empty(*this);
-
- sv::move(position + 1, this->end(), position); // may throw
- sv::destroy(this->end() - 1);
- --m_size;
-
- return position;
- }
-
- //! @pre
- //! @li \c first and \c last must define a valid range
- //! @li iterators must be in range <tt>[begin(), end()]</tt>
- //!
- //! @brief Erases Values from a range <tt>[first, last)</tt>.
- //!
- //! @param first The position of the first element of a range which will be erased from the container.
- //! @param last The position of the one after the last element of a range which will be erased from the container.
- //!
- //! @par Throws
- //! If Value's move assignment throws.
- //!
- //! @par Complexity
- //! Linear O(N).
- iterator erase(iterator first, iterator last)
- {
- namespace sv = static_vector_detail;
-
- errh::check_iterator_end_eq(*this, first);
- errh::check_iterator_end_eq(*this, last);
-
- difference_type n = std::distance(first, last);
-
- //TODO - add invalid range check?
- //BOOST_ASSERT_MSG(0 <= n, "invalid range");
- //TODO - add this->size() check?
- //BOOST_ASSERT_MSG(n <= this->size(), "invalid range");
-
- sv::move(last, this->end(), first); // may throw
- sv::destroy(this->end() - n, this->end());
- m_size -= n;
-
- return first;
- }
-
- //! @pre <tt>distance(first, last) <= capacity()</tt>
- //!
- //! @brief Assigns a range <tt>[first, last)</tt> of Values to this container.
- //!
- //! @param first The iterator to the first element of a range used to construct new content of this container.
- //! @param last The iterator to the one after the last element of a range used to construct new content of this container.
- //!
- //! @par Throws
- //! If Value's copy constructor or copy assignment throws,
- //!
- //! @par Complexity
- //! Linear O(N).
- template <typename Iterator>
- void assign(Iterator first, Iterator last)
- {
- BOOST_CONCEPT_ASSERT((boost_concepts::ForwardTraversal<Iterator>)); // Make sure you passed a ForwardIterator
-
- typedef typename boost::iterator_traversal<Iterator>::type traversal;
- this->assign_dispatch(first, last, traversal()); // may throw
- }
-
- //! @pre <tt>count <= capacity()</tt>
- //!
- //! @brief Assigns a count copies of value to this container.
- //!
- //! @param count The new number of elements which will be container in the container.
- //! @param value The value which will be used to copy construct the new content.
- //!
- //! @par Throws
- //! If Value's copy constructor or copy assignment throws.
- //!
- //! @par Complexity
- //! Linear O(N).
- void assign(size_type count, value_type const& value)
- {
- if ( count < m_size )
- {
- namespace sv = static_vector_detail;
-
- std::fill_n(this->begin(), count, value);
- sv::destroy(this->begin() + count, this->end());
- }
- else
- {
- errh::check_capacity(*this, count); // may throw
-
- std::fill_n(this->begin(), m_size, value);
- std::uninitialized_fill(this->end(), this->begin() + count, value); // may throw
- }
- m_size = count; // update end
- }
-
-#if !defined(BOOST_CONTAINER_STATIC_VECTOR_DISABLE_EMPLACE)
-#if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
- //! @pre <tt>size() < capacity()</tt>
- //!
- //! @brief Inserts a Value constructed with
- //! \c std::forward<Args>(args)... in the end of the container.
- //!
- //! @param args The arguments of the constructor of the new element which will be created at the end of the container.
- //!
- //! @par Throws
- //! If in-place constructor throws or Value's move constructor throws.
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Constant O(1).
- template<class ...Args>
- void emplace_back(Args &&...args)
- {
- errh::check_capacity(*this, m_size + 1); // may throw
-
- namespace sv = static_vector_detail;
- sv::construct(this->end(), ::boost::forward<Args>(args)...); // may throw
- ++m_size; // update end
- }
-
- //! @pre
- //! @li \c position must be a valid iterator of \c *this in range <tt>[begin(), end()]</tt>
- //! @li <tt>size() < capacity()</tt>
- //!
- //! @brief Inserts a Value constructed with
- //! \c std::forward<Args>(args)... before position
- //!
- //! @param position The position at which new elements will be inserted.
- //! @param args The arguments of the constructor of the new element.
- //!
- //! @par Throws
- //! If in-place constructor throws or if Value's move constructor or move assignment throws.
- //! @internal
- //! @li If a throwing error handler is specified, throws when the capacity is exceeded. (not by default).
- //! @endinternal
- //!
- //! @par Complexity
- //! Constant or linear.
- template<class ...Args>
- iterator emplace(iterator position, Args &&...args)
- {
- namespace sv = static_vector_detail;
-
- errh::check_iterator_end_eq(*this, position);
- errh::check_capacity(*this, m_size + 1); // may throw
-
- if ( position == this->end() )
- {
- sv::construct(position, ::boost::forward<Args>(args)...); // may throw
- ++m_size; // update end
- }
- else
- {
- // TODO - should following lines check for exception and revert to the old size?
-
- // TODO - should move be used only if it's nonthrowing?
- value_type & r = *(this->end() - 1);
- sv::construct(this->end(), boost::move(r)); // may throw
- ++m_size; // update end
- sv::move_backward(position, this->end() - 2, this->end() - 1); // may throw
-
- aligned_storage<sizeof(value_type), alignment_of<value_type>::value> temp_storage;
- value_type * val_p = static_cast<value_type *>(temp_storage.address());
- sv::construct(val_p, ::boost::forward<Args>(args)...); // may throw
- sv::scoped_destructor<value_type> d(val_p);
- sv::assign(position, ::boost::move(*val_p)); // may throw
- }
-
- return position;
- }
-
-#else // BOOST_CONTAINER_PERFECT_FORWARDING || BOOST_CONTAINER_DOXYGEN_INVOKED
-
- #define BOOST_PP_LOCAL_MACRO(n) \
- BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
- void emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
- { \
- errh::check_capacity(*this, m_size + 1); /*may throw*/\
- \
- namespace sv = static_vector_detail; \
- sv::construct(this->end() BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ); /*may throw*/\
- ++m_size; /*update end*/ \
- } \
- //
- #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
- #include BOOST_PP_LOCAL_ITERATE()
-
- #define BOOST_PP_LOCAL_MACRO(n) \
- BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
- iterator emplace(iterator position BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
- { \
- namespace sv = static_vector_detail; \
- \
- errh::check_iterator_end_eq(*this, position); \
- errh::check_capacity(*this, m_size + 1); /*may throw*/\
- \
- if ( position == this->end() ) \
- { \
- sv::construct(position BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ); /*may throw*/\
- ++m_size; /*update end*/ \
- } \
- else \
- { \
- /* TODO - should following lines check for exception and revert to the old size? */ \
- /* TODO - should move be used only if it's nonthrowing? */ \
- \
- value_type & r = *(this->end() - 1); \
- sv::construct(this->end(), boost::move(r)); /*may throw*/\
- ++m_size; /*update end*/ \
- sv::move_backward(position, this->end() - 2, this->end() - 1); /*may throw*/\
- \
- aligned_storage<sizeof(value_type), alignment_of<value_type>::value> temp_storage; \
- value_type * val_p = static_cast<value_type *>(temp_storage.address()); \
- sv::construct(val_p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ); /*may throw*/\
- sv::scoped_destructor<value_type> d(val_p); \
- sv::assign(position, ::boost::move(*val_p)); /*may throw*/\
- } \
- \
- return position; \
- } \
- //
- #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
- #include BOOST_PP_LOCAL_ITERATE()
-
-#endif // BOOST_CONTAINER_PERFECT_FORWARDING || BOOST_CONTAINER_DOXYGEN_INVOKED
-#endif // !BOOST_CONTAINER_STATIC_VECTOR_DISABLE_EMPLACE
-
- //! @brief Removes all elements from the container.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- void clear()
- {
- namespace sv = static_vector_detail;
- sv::destroy(this->begin(), this->end());
- m_size = 0; // update end
- }
-
- //! @pre <tt>i < size()</tt>
- //!
- //! @brief Returns reference to the i-th element.
- //!
- //! @param i The element's index.
- //!
- //! @return reference to the i-th element
- //! from the beginning of the container.
- //!
- //! @par Throws
- //! \c std::out_of_range exception by default.
- //!
- //! @par Complexity
- //! Constant O(1).
- reference at(size_type i)
- {
- errh::check_at(*this, i); // may throw
- return *(this->begin() + i);
- }
-
- //! @pre <tt>i < size()</tt>
- //!
- //! @brief Returns const reference to the i-th element.
- //!
- //! @param i The element's index.
- //!
- //! @return const reference to the i-th element
- //! from the beginning of the container.
- //!
- //! @par Throws
- //! \c std::out_of_range exception by default.
- //!
- //! @par Complexity
- //! Constant O(1).
- const_reference at(size_type i) const
- {
- errh::check_at(*this, i); // may throw
- return *(this->begin() + i);
- }
-
- //! @pre <tt>i < size()</tt>
- //!
- //! @brief Returns reference to the i-th element.
- //!
- //! @param i The element's index.
- //!
- //! @return reference to the i-th element
- //! from the beginning of the container.
- //!
- //! @par Throws
- //! Nothing by default.
- //!
- //! @par Complexity
- //! Constant O(1).
- reference operator[](size_type i)
- {
- // TODO: Remove bounds check? std::vector and std::array operator[] don't check.
- errh::check_operator_brackets(*this, i);
- return *(this->begin() + i);
- }
-
- //! @pre <tt>i < size()</tt>
- //!
- //! @brief Returns const reference to the i-th element.
- //!
- //! @param i The element's index.
- //!
- //! @return const reference to the i-th element
- //! from the beginning of the container.
- //!
- //! @par Throws
- //! Nothing by default.
- //!
- //! @par Complexity
- //! Constant O(1).
- const_reference operator[](size_type i) const
- {
- errh::check_operator_brackets(*this, i);
- return *(this->begin() + i);
- }
-
- //! @pre \c !empty()
- //!
- //! @brief Returns reference to the first element.
- //!
- //! @return reference to the first element
- //! from the beginning of the container.
- //!
- //! @par Throws
- //! Nothing by default.
- //!
- //! @par Complexity
- //! Constant O(1).
- reference front()
- {
- errh::check_empty(*this);
- return *(this->begin());
- }
-
- //! @pre \c !empty()
- //!
- //! @brief Returns const reference to the first element.
- //!
- //! @return const reference to the first element
- //! from the beginning of the container.
- //!
- //! @par Throws
- //! Nothing by default.
- //!
- //! @par Complexity
- //! Constant O(1).
- const_reference front() const
- {
- errh::check_empty(*this);
- return *(this->begin());
- }
-
- //! @pre \c !empty()
- //!
- //! @brief Returns reference to the last element.
- //!
- //! @return reference to the last element
- //! from the beginning of the container.
- //!
- //! @par Throws
- //! Nothing by default.
- //!
- //! @par Complexity
- //! Constant O(1).
- reference back()
- {
- errh::check_empty(*this);
- return *(this->end() - 1);
- }
-
- //! @pre \c !empty()
- //!
- //! @brief Returns const reference to the first element.
- //!
- //! @return const reference to the last element
- //! from the beginning of the container.
- //!
- //! @par Throws
- //! Nothing by default.
- //!
- //! @par Complexity
- //! Constant O(1).
- const_reference back() const
- {
- errh::check_empty(*this);
- return *(this->end() - 1);
- }
-
- //! @brief Pointer such that <tt>[data(), data() + size())</tt> is a valid range.
- //! For a non-empty vector <tt>data() == &front()</tt>.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- Value * data()
- {
- return boost::addressof(*(this->ptr()));
- }
-
- //! @brief Const pointer such that <tt>[data(), data() + size())</tt> is a valid range.
- //! For a non-empty vector <tt>data() == &front()</tt>.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- const Value * data() const
- {
- return boost::addressof(*(this->ptr()));
- }
-
-
- //! @brief Returns iterator to the first element.
- //!
- //! @return iterator to the first element contained in the vector.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- iterator begin() { return this->ptr(); }
-
- //! @brief Returns const iterator to the first element.
- //!
- //! @return const_iterator to the first element contained in the vector.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- const_iterator begin() const { return this->ptr(); }
-
- //! @brief Returns const iterator to the first element.
- //!
- //! @return const_iterator to the first element contained in the vector.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- const_iterator cbegin() const { return this->ptr(); }
-
- //! @brief Returns iterator to the one after the last element.
- //!
- //! @return iterator pointing to the one after the last element contained in the vector.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- iterator end() { return this->begin() + m_size; }
-
- //! @brief Returns const iterator to the one after the last element.
- //!
- //! @return const_iterator pointing to the one after the last element contained in the vector.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- const_iterator end() const { return this->begin() + m_size; }
-
- //! @brief Returns const iterator to the one after the last element.
- //!
- //! @return const_iterator pointing to the one after the last element contained in the vector.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- const_iterator cend() const { return this->cbegin() + m_size; }
-
- //! @brief Returns reverse iterator to the first element of the reversed container.
- //!
- //! @return reverse_iterator pointing to the beginning
- //! of the reversed static_vector.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- reverse_iterator rbegin() { return reverse_iterator(this->end()); }
-
- //! @brief Returns const reverse iterator to the first element of the reversed container.
- //!
- //! @return const_reverse_iterator pointing to the beginning
- //! of the reversed static_vector.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- const_reverse_iterator rbegin() const { return reverse_iterator(this->end()); }
-
- //! @brief Returns const reverse iterator to the first element of the reversed container.
- //!
- //! @return const_reverse_iterator pointing to the beginning
- //! of the reversed static_vector.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- const_reverse_iterator crbegin() const { return reverse_iterator(this->end()); }
-
- //! @brief Returns reverse iterator to the one after the last element of the reversed container.
- //!
- //! @return reverse_iterator pointing to the one after the last element
- //! of the reversed static_vector.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- reverse_iterator rend() { return reverse_iterator(this->begin()); }
-
- //! @brief Returns const reverse iterator to the one after the last element of the reversed container.
- //!
- //! @return const_reverse_iterator pointing to the one after the last element
- //! of the reversed static_vector.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- const_reverse_iterator rend() const { return reverse_iterator(this->begin()); }
-
- //! @brief Returns const reverse iterator to the one after the last element of the reversed container.
- //!
- //! @return const_reverse_iterator pointing to the one after the last element
- //! of the reversed static_vector.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- const_reverse_iterator crend() const { return reverse_iterator(this->begin()); }
-
- //! @brief Returns container's capacity.
- //!
- //! @return container's capacity.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- static size_type capacity() { return Capacity; }
-
- //! @brief Returns container's capacity.
- //!
- //! @return container's capacity.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- static size_type max_size() { return Capacity; }
-
- //! @brief Returns the number of stored elements.
- //!
- //! @return Number of elements contained in the container.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- size_type size() const { return m_size; }
-
- //! @brief Queries if the container contains elements.
- //!
- //! @return true if the number of elements contained in the
- //! container is equal to 0.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- bool empty() const { return 0 == m_size; }
-
- //! @brief Capacity is fixed so this call has no effects.
- //!
- //! @par Throws
- //! Nothing.
- //!
- //! @par Complexity
- //! Constant O(1).
- void shrink_to_fit() {}
-
-private:
-
- // @par Throws
- // Nothing.
- // @par Complexity
- // Linear O(N).
- template <std::size_t C, typename S>
- void move_ctor_dispatch(static_vector<value_type, C, S> & other, boost::true_type /*use_memop*/)
- {
- ::memcpy(this->data(), other.data(), sizeof(Value) * other.m_size);
- m_size = other.m_size;
- other.m_size = 0;
- }
-
- // @par Throws
- // @li If boost::has_nothrow_move<Value>::value is true and Value's move constructor throws
- // @li If boost::has_nothrow_move<Value>::value is false and Value's copy constructor throws.
- // @par Complexity
- // Linear O(N).
- template <std::size_t C, typename S>
- void move_ctor_dispatch(static_vector<value_type, C, S> & other, boost::false_type /*use_memop*/)
- {
- namespace sv = static_vector_detail;
- sv::uninitialized_move_if_noexcept(other.begin(), other.end(), this->begin()); // may throw
- m_size = other.m_size;
- sv::destroy(other.begin(), other.end());
- other.m_size = 0;
- }
-
- // @par Throws
- // Nothing.
- // @par Complexity
- // Linear O(N).
- template <std::size_t C, typename S>
- void move_assign_dispatch(static_vector<value_type, C, S> & other, boost::true_type /*use_memop*/)
- {
- this->clear();
-
- ::memcpy(this->data(), other.data(), sizeof(Value) * other.m_size);
- boost::swap(m_size, other.m_size);
- }
-
- // @par Throws
- // @li If boost::has_nothrow_move<Value>::value is true and Value's move constructor or move assignment throws
- // @li If boost::has_nothrow_move<Value>::value is false and Value's copy constructor or move assignment throws.
- // @par Complexity
- // Linear O(N).
- template <std::size_t C, typename S>
- void move_assign_dispatch(static_vector<value_type, C, S> & other, boost::false_type /*use_memop*/)
- {
- namespace sv = static_vector_detail;
- if ( m_size <= static_cast<size_type>(other.size()) )
- {
- sv::move_if_noexcept(other.begin(), other.begin() + m_size, this->begin()); // may throw
- // TODO - perform uninitialized_copy first?
- sv::uninitialized_move_if_noexcept(other.begin() + m_size, other.end(), this->end()); // may throw
- }
- else
- {
- sv::move_if_noexcept(other.begin(), other.end(), this->begin()); // may throw
- sv::destroy(this->begin() + other.size(), this->end());
- }
- m_size = other.size(); // update end
-
- other.clear();
- }
-
- // @par Throws
- // Nothing.
- // @par Complexity
- // Linear O(N).
- template <std::size_t C, typename S>
- void swap_dispatch(static_vector<value_type, C, S> & other, boost::true_type const& /*use_optimized_swap*/)
- {
- typedef typename
- boost::mpl::if_c<
- Capacity < C,
- aligned_storage_type,
- typename static_vector<value_type, C, S>::aligned_storage_type
- >::type
- storage_type;
-
- storage_type temp;
- Value * temp_ptr = reinterpret_cast<Value*>(temp.address());
-
- ::memcpy(temp_ptr, this->data(), sizeof(Value) * this->size());
- ::memcpy(this->data(), other.data(), sizeof(Value) * other.size());
- ::memcpy(other.data(), temp_ptr, sizeof(Value) * this->size());
-
- boost::swap(m_size, other.m_size);
- }
-
- // @par Throws
- // If Value's move constructor or move assignment throws
- // but only if use_memop_in_swap_and_move is false_type - default.
- // @par Complexity
- // Linear O(N).
- template <std::size_t C, typename S>
- void swap_dispatch(static_vector<value_type, C, S> & other, boost::false_type const& /*use_optimized_swap*/)
- {
- namespace sv = static_vector_detail;
-
- typedef typename
- static_vector_detail::static_vector_traits<
- Value, Capacity, Strategy
- >::use_memop_in_swap_and_move use_memop_in_swap_and_move;
-
- if ( this->size() < other.size() )
- swap_dispatch_impl(this->begin(), this->end(), other.begin(), other.end(), use_memop_in_swap_and_move()); // may throw
- else
- swap_dispatch_impl(other.begin(), other.end(), this->begin(), this->end(), use_memop_in_swap_and_move()); // may throw
- boost::swap(m_size, other.m_size);
- }
-
- // @par Throws
- // Nothing.
- // @par Complexity
- // Linear O(N).
- void swap_dispatch_impl(iterator first_sm, iterator last_sm, iterator first_la, iterator last_la, boost::true_type const& /*use_memop*/)
- {
- //BOOST_ASSERT_MSG(std::distance(first_sm, last_sm) <= std::distance(first_la, last_la));
-
- namespace sv = static_vector_detail;
- for (; first_sm != last_sm ; ++first_sm, ++first_la)
- {
- boost::aligned_storage<
- sizeof(value_type),
- boost::alignment_of<value_type>::value
- > temp_storage;
- value_type * temp_ptr = reinterpret_cast<value_type*>(temp_storage.address());
-
- ::memcpy(temp_ptr, boost::addressof(*first_sm), sizeof(value_type));
- ::memcpy(boost::addressof(*first_sm), boost::addressof(*first_la), sizeof(value_type));
- ::memcpy(boost::addressof(*first_la), temp_ptr, sizeof(value_type));
- }
-
- ::memcpy(first_sm, first_la, sizeof(value_type) * std::distance(first_la, last_la));
- }
-
- // @par Throws
- // If Value's move constructor or move assignment throws.
- // @par Complexity
- // Linear O(N).
- void swap_dispatch_impl(iterator first_sm, iterator last_sm, iterator first_la, iterator last_la, boost::false_type const& /*use_memop*/)
- {
- //BOOST_ASSERT_MSG(std::distance(first_sm, last_sm) <= std::distance(first_la, last_la));
-
- namespace sv = static_vector_detail;
- for (; first_sm != last_sm ; ++first_sm, ++first_la)
- {
- //boost::swap(*first_sm, *first_la); // may throw
- value_type temp(boost::move(*first_sm)); // may throw
- *first_sm = boost::move(*first_la); // may throw
- *first_la = boost::move(temp); // may throw
- }
- sv::uninitialized_move(first_la, last_la, first_sm); // may throw
- sv::destroy(first_la, last_la);
- }
-
- // insert
-
- // @par Throws
- // If Value's move constructor or move assignment throws
- // or if Value's copy assignment throws.
- // @par Complexity
- // Linear O(N).
- template <typename V>
- iterator priv_insert(iterator position, V & value)
- {
- namespace sv = static_vector_detail;
-
- errh::check_iterator_end_eq(*this, position);
- errh::check_capacity(*this, m_size + 1); // may throw
-
- if ( position == this->end() )
- {
- sv::construct(position, value); // may throw
- ++m_size; // update end
- }
- else
- {
- // TODO - should following lines check for exception and revert to the old size?
-
- // TODO - should move be used only if it's nonthrowing?
- value_type & r = *(this->end() - 1);
- sv::construct(this->end(), boost::move(r)); // may throw
- ++m_size; // update end
- sv::move_backward(position, this->end() - 2, this->end() - 1); // may throw
- sv::assign(position, value); // may throw
- }
-
- return position;
- }
-
- // insert
-
- // @par Throws
- // If Value's move constructor, move assignment throws
- // or if Value's copy constructor or copy assignment throws.
- // @par Complexity
- // Linear O(N).
- template <typename Iterator>
- void insert_dispatch(iterator position, Iterator first, Iterator last, boost::random_access_traversal_tag const&)
- {
- BOOST_CONCEPT_ASSERT((boost_concepts::RandomAccessTraversal<Iterator>)); // Make sure you passed a RandomAccessIterator
-
- errh::check_iterator_end_eq(*this, position);
-
- typename boost::iterator_difference<Iterator>::type
- count = std::distance(first, last);
-
- errh::check_capacity(*this, m_size + count); // may throw
-
- if ( position == this->end() )
- {
- namespace sv = static_vector_detail;
-
- sv::uninitialized_copy(first, last, position); // may throw
- m_size += count; // update end
- }
- else
- {
- this->insert_in_the_middle(position, first, last, count); // may throw
- }
- }
-
- // @par Throws
- // If Value's move constructor, move assignment throws
- // or if Value's copy constructor or copy assignment throws.
- // @par Complexity
- // Linear O(N).
- template <typename Iterator, typename Traversal>
- void insert_dispatch(iterator position, Iterator first, Iterator last, Traversal const& /*not_random_access*/)
- {
- errh::check_iterator_end_eq(*this, position);
-
- if ( position == this->end() )
- {
- namespace sv = static_vector_detail;
-
- std::ptrdiff_t d = std::distance(position, this->begin() + Capacity);
- std::size_t count = sv::uninitialized_copy_s(first, last, position, d); // may throw
-
- errh::check_capacity(*this, count <= static_cast<std::size_t>(d) ? m_size + count : Capacity + 1); // may throw
-
- m_size += count;
- }
- else
- {
- typename boost::iterator_difference<Iterator>::type
- count = std::distance(first, last);
-
- errh::check_capacity(*this, m_size + count); // may throw
-
- this->insert_in_the_middle(position, first, last, count); // may throw
- }
- }
-
- // @par Throws
- // If Value's move constructor, move assignment throws
- // or if Value's copy constructor or copy assignment throws.
- // @par Complexity
- // Linear O(N).
- template <typename Iterator>
- void insert_in_the_middle(iterator position, Iterator first, Iterator last, difference_type count)
- {
- namespace sv = static_vector_detail;
-
- difference_type to_move = std::distance(position, this->end());
-
- // TODO - should following lines check for exception and revert to the old size?
-
- if ( count < to_move )
- {
- sv::uninitialized_move(this->end() - count, this->end(), this->end()); // may throw
- m_size += count; // update end
- sv::move_backward(position, position + to_move - count, this->end() - count); // may throw
- sv::copy(first, last, position); // may throw
- }
- else
- {
- Iterator middle_iter = first;
- std::advance(middle_iter, to_move);
-
- sv::uninitialized_copy(middle_iter, last, this->end()); // may throw
- m_size += count - to_move; // update end
- sv::uninitialized_move(position, position + to_move, position + count); // may throw
- m_size += to_move; // update end
- sv::copy(first, middle_iter, position); // may throw
- }
- }
-
- // assign
-
- // @par Throws
- // If Value's constructor or assignment taking dereferenced Iterator throws.
- // @par Complexity
- // Linear O(N).
- template <typename Iterator>
- void assign_dispatch(Iterator first, Iterator last, boost::random_access_traversal_tag const& /*not_random_access*/)
- {
- namespace sv = static_vector_detail;
-
- typename boost::iterator_difference<Iterator>::type
- s = std::distance(first, last);
-
- errh::check_capacity(*this, s); // may throw
-
- if ( m_size <= static_cast<size_type>(s) )
- {
- sv::copy(first, first + m_size, this->begin()); // may throw
- // TODO - perform uninitialized_copy first?
- sv::uninitialized_copy(first + m_size, last, this->end()); // may throw
- }
- else
- {
- sv::copy(first, last, this->begin()); // may throw
- sv::destroy(this->begin() + s, this->end());
- }
- m_size = s; // update end
- }
-
- // @par Throws
- // If Value's constructor or assignment taking dereferenced Iterator throws.
- // @par Complexity
- // Linear O(N).
- template <typename Iterator, typename Traversal>
- void assign_dispatch(Iterator first, Iterator last, Traversal const& /*not_random_access*/)
- {
- namespace sv = static_vector_detail;
-
- size_type s = 0;
- iterator it = this->begin();
-
- for ( ; it != this->end() && first != last ; ++it, ++first, ++s )
- *it = *first; // may throw
-
- sv::destroy(it, this->end());
-
- std::ptrdiff_t d = std::distance(it, this->begin() + Capacity);
- std::size_t count = sv::uninitialized_copy_s(first, last, it, d); // may throw
- s += count;
-
- errh::check_capacity(*this, count <= static_cast<std::size_t>(d) ? s : Capacity + 1); // may throw
-
- m_size = s; // update end
- }
-
- pointer ptr()
- {
- return pointer(static_cast<Value*>(m_storage.address()));
- }
-
- const_pointer ptr() const
- {
- return const_pointer(static_cast<const Value*>(m_storage.address()));
- }
-
- size_type m_size;
- aligned_storage_type m_storage;
-};
+ { base_t::operator=(other); return *this; }
 
-#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
-
-template<typename Value, typename Strategy>
-class static_vector<Value, 0, Strategy>
-{
- typedef static_vector_detail::static_vector_traits<
- Value, 0, Strategy
- > vt;
-
- typedef typename vt::size_type stored_size_type;
- typedef typename vt::error_handler errh;
-
-public:
- typedef typename vt::value_type value_type;
- typedef stored_size_type size_type;
- typedef typename vt::difference_type difference_type;
- typedef typename vt::pointer pointer;
- typedef typename vt::const_pointer const_pointer;
- typedef typename vt::reference reference;
- typedef typename vt::const_reference const_reference;
-
- typedef pointer iterator;
- typedef const_pointer const_iterator;
- typedef boost::reverse_iterator<iterator> reverse_iterator;
- typedef boost::reverse_iterator<const_iterator> const_reverse_iterator;
-
- // nothrow
- static_vector() {}
-
- // strong
- explicit static_vector(size_type count)
- {
- errh::check_capacity(*this, count); // may throw
- }
-
- // strong
- static_vector(size_type count, value_type const&)
- {
- errh::check_capacity(*this, count); // may throw
- }
-
- // strong
- static_vector(static_vector const& other)
- {
- //errh::check_capacity(*this, count);
- }
-
- // strong
- template <size_t C, typename S>
- static_vector(static_vector<value_type, C, S> const& other)
- {
- errh::check_capacity(*this, other.size()); // may throw
- }
-
- // strong
- template <typename Iterator>
- static_vector(Iterator first, Iterator last)
- {
- errh::check_capacity(*this, std::distance(first, last)); // may throw
- }
+ varray(BOOST_RV_REF(varray) other) : base_t(boost::move(static_cast<base_t&>(other))) {}
+ template <std::size_t C>
+ varray(BOOST_RV_REF_2_TEMPL_ARGS(varray, value_type, C) other)
+ : base_t(boost::move(static_cast<container_detail::varray<value_type, C>&>(other)))
+ {}
 
- // basic
- static_vector & operator=(static_vector const& other)
+ varray & operator=(BOOST_RV_REF(varray) other)
     {
- //errh::check_capacity(*this, other.size());
+ base_t::operator=(boost::move(static_cast<base_t&>(other)));
         return *this;
     }
 
- // basic
- template <size_t C, typename S>
- static_vector & operator=(static_vector<value_type, C, S> const& other)
+ template <std::size_t C>
+ varray & operator=(BOOST_RV_REF_2_TEMPL_ARGS(varray, value_type, C) other)
     {
- errh::check_capacity(*this, other.size()); // may throw
+ base_t::operator=(boost::move(static_cast<container_detail::varray<value_type, C>&>(other)));
         return *this;
     }
-
- // nothrow
- ~static_vector() {}
-
- // strong
- void resize(size_type count)
- {
- errh::check_capacity(*this, count); // may throw
- }
-
- // strong
- void resize(size_type count, value_type const&)
- {
- errh::check_capacity(*this, count); // may throw
- }
-
-
- // nothrow
- void reserve(size_type count)
- {
- errh::check_capacity(*this, count); // may throw
- }
-
- // strong
- void push_back(value_type const&)
- {
- errh::check_capacity(*this, 1); // may throw
- }
-
- // nothrow
- void pop_back()
- {
- errh::check_empty(*this);
- }
-
- // basic
- void insert(iterator position, value_type const&)
- {
- errh::check_iterator_end_eq(*this, position);
- errh::check_capacity(*this, 1); // may throw
- }
-
- // basic
- void insert(iterator position, size_type count, value_type const&)
- {
- errh::check_iterator_end_eq(*this, position);
- errh::check_capacity(*this, count); // may throw
- }
-
- // basic
- template <typename Iterator>
- void insert(iterator, Iterator first, Iterator last)
- {
- // TODO - add MPL_ASSERT, check if Iterator is really an iterator
- typedef typename boost::iterator_traversal<Iterator>::type traversal;
- errh::check_capacity(*this, std::distance(first, last)); // may throw
- }
-
- // basic
- void erase(iterator position)
- {
- errh::check_iterator_end_neq(*this, position);
- }
-
- // basic
- void erase(iterator first, iterator last)
- {
- errh::check_iterator_end_eq(*this, first);
- errh::check_iterator_end_eq(*this, last);
-
- //BOOST_ASSERT_MSG(0 <= n, "invalid range");
- }
-
- // basic
- template <typename Iterator>
- void assign(Iterator first, Iterator last)
- {
- // TODO - add MPL_ASSERT, check if Iterator is really an iterator
- typedef typename boost::iterator_traversal<Iterator>::type traversal;
- errh::check_capacity(*this, std::distance(first, last)); // may throw
- }
-
- // basic
- void assign(size_type count, value_type const&)
- {
- errh::check_capacity(*this, count); // may throw
- }
-
- // nothrow
- void clear() {}
-
- // strong
- reference at(size_type i)
- {
- errh::check_at(*this, i); // may throw
- return *(this->begin() + i);
- }
-
- // strong
- const_reference at(size_type i) const
- {
- errh::check_at(*this, i); // may throw
- return *(this->begin() + i);
- }
-
- // nothrow
- reference operator[](size_type i)
- {
- errh::check_operator_brackets(*this, i);
- return *(this->begin() + i);
- }
-
- // nothrow
- const_reference operator[](size_type i) const
- {
- errh::check_operator_brackets(*this, i);
- return *(this->begin() + i);
- }
-
- // nothrow
- reference front()
- {
- errh::check_empty(*this);
- return *(this->begin());
- }
-
- // nothrow
- const_reference front() const
- {
- errh::check_empty(*this);
- return *(this->begin());
- }
-
- // nothrow
- reference back()
- {
- errh::check_empty(*this);
- return *(this->end() - 1);
- }
-
- // nothrow
- const_reference back() const
- {
- errh::check_empty(*this);
- return *(this->end() - 1);
- }
-
- // nothrow
- Value * data() { return boost::addressof(*(this->ptr())); }
- const Value * data() const { return boost::addressof(*(this->ptr())); }
-
- // nothrow
- iterator begin() { return this->ptr(); }
- const_iterator begin() const { return this->ptr(); }
- const_iterator cbegin() const { return this->ptr(); }
- iterator end() { return this->begin(); }
- const_iterator end() const { return this->begin(); }
- const_iterator cend() const { return this->cbegin(); }
- // nothrow
- reverse_iterator rbegin() { return reverse_iterator(this->end()); }
- const_reverse_iterator rbegin() const { return reverse_iterator(this->end()); }
- const_reverse_iterator crbegin() const { return reverse_iterator(this->end()); }
- reverse_iterator rend() { return reverse_iterator(this->begin()); }
- const_reverse_iterator rend() const { return reverse_iterator(this->begin()); }
- const_reverse_iterator crend() const { return reverse_iterator(this->begin()); }
-
- // nothrow
- size_type capacity() const { return 0; }
- size_type max_size() const { return 0; }
- size_type size() const { return 0; }
- bool empty() const { return true; }
- void shrink_to_fit() {}
-
-private:
-
- pointer ptr()
- {
- return pointer(reinterpret_cast<Value*>(this));
- }
-
- const_pointer ptr() const
- {
- return const_pointer(reinterpret_cast<const Value*>(this));
- }
 };
 
-#endif // !BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION && !BOOST_CONTAINER_DOXYGEN_INVOKED
-
-//! @brief Checks if contents of two static_vectors are equal.
-//!
-//! @ingroup static_vector_non_member
-//!
-//! @param x The first static_vector.
-//! @param y The second static_vector.
-//!
-//! @return \c true if containers have the same size and elements in both containers are equal.
-//!
-//! @par Complexity
-//! Linear O(N).
-template<typename V, std::size_t C1, typename S1, std::size_t C2, typename S2>
-bool operator== (static_vector<V, C1, S1> const& x, static_vector<V, C2, S2> const& y)
-{
- return x.size() == y.size() && std::equal(x.begin(), x.end(), y.begin());
-}
-
-//! @brief Checks if contents of two static_vectors are not equal.
-//!
-//! @ingroup static_vector_non_member
-//!
-//! @param x The first static_vector.
-//! @param y The second static_vector.
-//!
-//! @return \c true if containers have different size or elements in both containers are not equal.
-//!
-//! @par Complexity
-//! Linear O(N).
-template<typename V, std::size_t C1, typename S1, std::size_t C2, typename S2>
-bool operator!= (static_vector<V, C1, S1> const& x, static_vector<V, C2, S2> const& y)
-{
- return !(x==y);
-}
-
-//! @brief Lexicographically compares static_vectors.
-//!
-//! @ingroup static_vector_non_member
-//!
-//! @param x The first static_vector.
-//! @param y The second static_vector.
-//!
-//! @return \c true if x compares lexicographically less than y.
-//!
-//! @par Complexity
-//! Linear O(N).
-template<typename V, std::size_t C1, typename S1, std::size_t C2, typename S2>
-bool operator< (static_vector<V, C1, S1> const& x, static_vector<V, C2, S2> const& y)
-{
- return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end());
-}
-
-//! @brief Lexicographically compares static_vectors.
-//!
-//! @ingroup static_vector_non_member
-//!
-//! @param x The first static_vector.
-//! @param y The second static_vector.
-//!
-//! @return \c true if y compares lexicographically less than x.
-//!
-//! @par Complexity
-//! Linear O(N).
-template<typename V, std::size_t C1, typename S1, std::size_t C2, typename S2>
-bool operator> (static_vector<V, C1, S1> const& x, static_vector<V, C2, S2> const& y)
-{
- return y<x;
-}
-
-//! @brief Lexicographically compares static_vectors.
-//!
-//! @ingroup static_vector_non_member
-//!
-//! @param x The first static_vector.
-//! @param y The second static_vector.
-//!
-//! @return \c true if y don't compare lexicographically less than x.
-//!
-//! @par Complexity
-//! Linear O(N).
-template<typename V, std::size_t C1, typename S1, std::size_t C2, typename S2>
-bool operator<= (static_vector<V, C1, S1> const& x, static_vector<V, C2, S2> const& y)
-{
- return !(y<x);
-}
-
-//! @brief Lexicographically compares static_vectors.
-//!
-//! @ingroup static_vector_non_member
-//!
-//! @param x The first static_vector.
-//! @param y The second static_vector.
-//!
-//! @return \c true if x don't compare lexicographically less than y.
-//!
-//! @par Complexity
-//! Linear O(N).
-template<typename V, std::size_t C1, typename S1, std::size_t C2, typename S2>
-bool operator>= (static_vector<V, C1, S1> const& x, static_vector<V, C2, S2> const& y)
-{
- return !(x<y);
-}
-
-//! @brief Swaps contents of two static_vectors.
-//!
-//! This function calls static_vector::swap().
-//!
-//! @ingroup static_vector_non_member
-//!
-//! @param x The first static_vector.
-//! @param y The second static_vector.
-//!
-//! @par Complexity
-//! Linear O(N).
-template<typename V, std::size_t C1, typename S1, std::size_t C2, typename S2>
-inline void swap(static_vector<V, C1, S1> & x, static_vector<V, C2, S2> & y)
-{
- x.swap(y);
-}
-
 }} // namespace boost::container
 
-#include <boost/container/detail/config_end.hpp>
-
-#endif // BOOST_CONTAINER_STATIC_VECTOR_HPP
+#endif // BOOST_CONTAINER_VARRAY_HPP

Modified: sandbox/varray/doc/Jamfile.v2
==============================================================================
--- sandbox/varray/doc/Jamfile.v2 (original)
+++ sandbox/varray/doc/Jamfile.v2 2013-01-26 22:36:10 EST (Sat, 26 Jan 2013)
@@ -7,17 +7,17 @@
 # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
 # http://www.boost.org/LICENSE_1_0.txt)
 
-project container_static_vector/doc ;
+project container_varray/doc ;
 
 import boostbook ;
 import quickbook ;
 
-boostbook container_static_vector
+boostbook container_varray
    :
- static_vector.qbk
+ varray.qbk
    :
         <dependency>Jamfile.v2
- <dependency>generated/static_vector.qbk
+ <dependency>generated/varray.qbk
         
         <format>html
         <format>pdf:<xsl:param>boost.url.prefix=http://www.boost.org/doc/libs/release/doc/html

Deleted: sandbox/varray/doc/generated/static_vector.qbk
==============================================================================
--- sandbox/varray/doc/generated/static_vector.qbk 2013-01-26 22:36:10 EST (Sat, 26 Jan 2013)
+++ (empty file)
@@ -1,1611 +0,0 @@
-[/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically]
-[/ Generated from xml/classboost_1_1container_1_1static__vector.xml]
-[#classboost_1_1container_1_1static__vector]
-[section:boost_container_static_vector boost::container::static_vector]
-
-'''<indexterm><primary>boost</primary></indexterm><indexterm><primary>container</primary></indexterm><indexterm><primary>static_vector</primary></indexterm>'''
-A hybrid of [^`boost::container::vector`] and [^`boost::array`] with fixed capacity.
-
-[heading Description]
-[link classboost_1_1container_1_1static__vector static_vector] is a sequence container like boost::container::vector with contiguous storage that can change in size, along with the static allocation, low overhead, and fixed capacity of boost::array.
-
-A [link classboost_1_1container_1_1static__vector static_vector] is a sequence that supports random access to elements, constant time insertion and removal of elements at the end, and linear time insertion and removal of elements at the beginning or in the middle. The number of elements in a [link classboost_1_1container_1_1static__vector static_vector] may vary dynamically up to a fixed capacity because elements are stored within the object itself similarly to an array. However, objects are initialized as they are inserted into [link classboost_1_1container_1_1static__vector static_vector] unlike C arrays or std::array which must construct all elements on instantiation. The behavior of [link classboost_1_1container_1_1static__vector static_vector] enables the use of statically allocated elements in cases with complex object lifetime requirements that would otherwise not be trivially possible.
-
-[heading Error Handling]
-Insertion beyond the capacity and out of bounds errors result in undefined behavior unless otherwise specified. In this respect if [link classboost_1_1container_1_1static__vector_1af2a0e0148e73a8b6799ac7af3a26d6a3 size()] == [link classboost_1_1container_1_1static__vector_1aabaf12d350a1b5457ba8ae4176819844 capacity()], then [link classboost_1_1container_1_1static__vector_1ae61c0bcedf9162c63c8b738ddfaed93d static_vector::push_back()] behaves like std::vector pop_front() if [link classboost_1_1container_1_1static__vector_1af2a0e0148e73a8b6799ac7af3a26d6a3 size()] == [link classboost_1_1container_1_1static__vector_1aa408660722a22b80104613e28c514fc8 empty()]. The reason for this difference is because unlike vectors, [link classboost_1_1container_1_1static__vector static_vector] does not perform allocation.
-
-[heading Advanced Usage]
-Error handling behavior can be modified to more closely match std::vector exception behavior when exceeding bounds by providing an alternate Strategy and static_vector_traits instantiation.
-
-[heading Header]
-`#include <boost/container/static_vector.hpp>`
-
-[heading Synopsis]
-[pre
-`template<``typename Value``,`
- `std::size_t Capacity``,`
- `typename Strategy` = [^[link structboost_1_1container_1_1strategy_1_1def strategy::def]]`<Value>``>`
-`class static_vector`
-`{`
-` // ...`
-`};`
-]
-
-[heading Template parameter(s)]
-[table
-[[Parameter] [Description]]
-[[`Value`][The type of element that will be stored. ]]
-[[`std::size_t Capacity`][The maximum number of elements [link classboost_1_1container_1_1static__vector static_vector] can store, fixed at compile time. ]]
-[[`Strategy`][Defines the public typedefs and error handlers, implements StaticVectorStrategy and has some similarities to an Allocator. ]]
-]
-
-[heading Typedef(s)]
-[table
-[[Type] [Description]]
-[[[#classboost_1_1container_1_1static__vector_1a5985fc0bab97e6e2b923c9b97ef32b7e] `value_type`][The type of elements stored in the container. ]]
-[[[#classboost_1_1container_1_1static__vector_1a4805729a79dc41f690c279636e20b31e] `size_type`][The unsigned integral type used by the container. ]]
-[[[#classboost_1_1container_1_1static__vector_1a5cdd8942ad9c5e23e0917b2f63098609] `difference_type`][The pointers difference type. ]]
-[[[#classboost_1_1container_1_1static__vector_1a28243d9bbc185be8ac96225143341c66] `pointer`][The pointer type. ]]
-[[[#classboost_1_1container_1_1static__vector_1a1ee7ffa97928f7f71f8a6ff13d9e74c0] `const_pointer`][The const pointer type. ]]
-[[[#classboost_1_1container_1_1static__vector_1a24cb3c33ddbeab8b6a82ac03a8482f16] `reference`][The value reference type. ]]
-[[[#classboost_1_1container_1_1static__vector_1a05ebdcd801a4e03109a709ab91981e4a] `const_reference`][The value const reference type. ]]
-[[[#classboost_1_1container_1_1static__vector_1ae9387f4d5cba4f4f87ad06222b46357e] `iterator`][The iterator type. ]]
-[[[#classboost_1_1container_1_1static__vector_1af9d23146b9e766c7ea2453a48ca63eae] `const_iterator`][The const iterator type. ]]
-[[[#classboost_1_1container_1_1static__vector_1ab143d0cd51d29d261dd705a957d9969a] `reverse_iterator`][The reverse iterator type. ]]
-[[[#classboost_1_1container_1_1static__vector_1aedca56b1b3e41ef352f7cc5c4dabdcd4] `const_reverse_iterator`][The const reverse iterator. ]]
-[[[#classboost_1_1container_1_1static__vector_1a041d1b8def12d8781f34f32a12fd53d0] `strategy_type`][The type of a strategy used by the [link classboost_1_1container_1_1static__vector static_vector]. ]]
-]
-
-[heading Constructor(s) and destructor]
-[table
-[[Function][Description]]
-[[[link classboost_1_1container_1_1static__vector_1ae0f7f391d06180aea516a6b03b3402c2 `static_vector()`]][Constructs an empty [link classboost_1_1container_1_1static__vector static_vector]. ]]
-[[[link classboost_1_1container_1_1static__vector_1ab6461f56b1a46dc3e708e22d24b262c5 `static_vector(size_type)`]][Constructs a [link classboost_1_1container_1_1static__vector static_vector] containing count default constructed Values. ]]
-[[[link classboost_1_1container_1_1static__vector_1a5f0a8f8d5a685d0d9ed9c54e202c7c3c `static_vector(size_type, value_type const &)`]][Constructs a [link classboost_1_1container_1_1static__vector static_vector] containing count copies of value. ]]
-[[[link classboost_1_1container_1_1static__vector_1a5e2c5c81fe53874667e3b9c2c07757b3 `static_vector(Iterator, Iterator)`]][Constructs a [link classboost_1_1container_1_1static__vector static_vector] containing copy of a range [^`[first, last)`]. ]]
-[[[link classboost_1_1container_1_1static__vector_1a48efc321954acc24a3a6f37a26c676f2 `static_vector(static_vector const &)`]][Constructs a copy of other [link classboost_1_1container_1_1static__vector static_vector]. ]]
-[[[link classboost_1_1container_1_1static__vector_1ae9a84810e47883c67b51dbaf760a6c1b `static_vector(static_vector<...> const &)`]][Constructs a copy of other [link classboost_1_1container_1_1static__vector static_vector]. ]]
-[[[link classboost_1_1container_1_1static__vector_1a5e19b124c38ed45fbd5868349622c228 `static_vector(static_vector &&)`]][Move constructor. Moves Values stored in the other [link classboost_1_1container_1_1static__vector static_vector] to this one. ]]
-[[[link classboost_1_1container_1_1static__vector_1ab680dfce94853dbcbffa7c789199e668 `static_vector(static_vector<...> &&)`]][Move constructor. Moves Values stored in the other [link classboost_1_1container_1_1static__vector static_vector] to this one. ]]
-[[[link classboost_1_1container_1_1static__vector_1a047c909045c5fdc2dfba86d82bde57f5 `~static_vector()`]][Destructor. Destroys Values stored in this container. ]]
-]
-
-[heading Member(s)]
-[table
-[[Modifier][Function][Description]]
-[[][[link classboost_1_1container_1_1static__vector_1a22aae352c5cfe7f9ccb0fda5a900ec98 `operator=(const static_vector &)`]][Copy assigns Values stored in the other [link classboost_1_1container_1_1static__vector static_vector] to this one. ]]
-[[][[link classboost_1_1container_1_1static__vector_1a58b56229fbbb996c394d89db80f8751d `operator=(static_vector<...> const &)`]][Copy assigns Values stored in the other [link classboost_1_1container_1_1static__vector static_vector] to this one. ]]
-[[][[link classboost_1_1container_1_1static__vector_1a736084d326ffa4d50ec2dd15fd4dadca `operator=(static_vector &&)`]][Move assignment. Moves Values stored in the other [link classboost_1_1container_1_1static__vector static_vector] to this one. ]]
-[[][[link classboost_1_1container_1_1static__vector_1a03eaa538061845c7477ea5aba4f5fd7e `operator=(static_vector<...> &&)`]][Move assignment. Moves Values stored in the other [link classboost_1_1container_1_1static__vector static_vector] to this one. ]]
-[[][[link classboost_1_1container_1_1static__vector_1a12cdeec047f6d310fe6a1746ddbf41d1 `swap(static_vector &)`]][Swaps contents of the other [link classboost_1_1container_1_1static__vector static_vector] and this one. ]]
-[[][[link classboost_1_1container_1_1static__vector_1a7a668affb50dad8ae4c92bff03ae9f22 `swap(static_vector<...> &)`]][Swaps contents of the other [link classboost_1_1container_1_1static__vector static_vector] and this one. ]]
-[[][[link classboost_1_1container_1_1static__vector_1acf7bf2c6ce597df2bfde495d9ee1bebd `resize(size_type)`]][Inserts or erases elements at the end such that the size becomes count. New elements are default constructed. ]]
-[[][[link classboost_1_1container_1_1static__vector_1a19cd77b2fdcda815b780e65b2fb66cc9 `resize(size_type, value_type const &)`]][Inserts or erases elements at the end such that the size becomes count. New elements are copy constructed from value. ]]
-[[][[link classboost_1_1container_1_1static__vector_1a9553bdd8a9f3f98fdbdd3a5a46fb9474 `reserve(size_type)`]][This call has no effect because the Capacity of this container is constant. ]]
-[[][[link classboost_1_1container_1_1static__vector_1ae61c0bcedf9162c63c8b738ddfaed93d `push_back(value_type const &)`]][Adds a copy of value at the end. ]]
-[[][[link classboost_1_1container_1_1static__vector_1a8d23922fd8d2bd57b8125253e8a06c4d `push_back(value_type &&)`]][Moves value to the end. ]]
-[[][[link classboost_1_1container_1_1static__vector_1a7be88e699c34a01953279e8f5b9deec4 `pop_back()`]][Destroys last value and decreases the size. ]]
-[[][[link classboost_1_1container_1_1static__vector_1a949c881458809c08e0c6de6f54871fdf `insert(iterator, value_type const &)`]][Inserts a copy of element at position. ]]
-[[][[link classboost_1_1container_1_1static__vector_1a93e722fcda2a5454901292642fcabfba `insert(iterator, value_type &&)`]][Inserts a move-constructed element at position. ]]
-[[][[link classboost_1_1container_1_1static__vector_1a6381368d09a3b93c1bc6c28199f9810c `insert(iterator, size_type, value_type const &)`]][Inserts a count copies of value at position. ]]
-[[][[link classboost_1_1container_1_1static__vector_1a7f3daa5ea1faae1f75f2f33f8fc5c15c `insert(iterator, Iterator, Iterator)`]][Inserts a copy of a range [^`[first, last)`] at position. ]]
-[[][[link classboost_1_1container_1_1static__vector_1aa8ba2711fd2390953a10f02eb464d269 `erase(iterator)`]][Erases Value from position. ]]
-[[][[link classboost_1_1container_1_1static__vector_1a2fc879a077c834f4305efc21706e033c `erase(iterator, iterator)`]][Erases Values from a range [^`[first, last)`]. ]]
-[[][[link classboost_1_1container_1_1static__vector_1a5f820fa73c4728fed1df89da341b98cb `assign(Iterator, Iterator)`]][Assigns a range [^`[first, last)`] of Values to this container. ]]
-[[][[link classboost_1_1container_1_1static__vector_1ac589c93c8b59e5712b0225a9b424f50f `assign(size_type, value_type const &)`]][Assigns a count copies of value to this container. ]]
-[[][[link classboost_1_1container_1_1static__vector_1ac00c9401b86fdbf8816540ce92329f40 `emplace_back(Args &&...)`]][Inserts a Value constructed with [^`std::forward<Args>(args)`]... in the end of the container. ]]
-[[][[link classboost_1_1container_1_1static__vector_1ae06ce1a29316261d44920ca0d3836dad `emplace(iterator, Args &&...)`]][Inserts a Value constructed with [^`std::forward<Args>(args)`]... before position. ]]
-[[][[link classboost_1_1container_1_1static__vector_1a11ae430a28a7f9b9636f249bfc932a50 `clear()`]][Removes all elements from the container. ]]
-[[][[link classboost_1_1container_1_1static__vector_1a2ab748bbf59967f381131dc2ded8878e `at(size_type)`]][Returns reference to the i-th element. ]]
-[[ `const`][[link classboost_1_1container_1_1static__vector_1ad69bcb249614e043de9ad3c30848a046 `at(size_type)`]][Returns const reference to the i-th element. ]]
-[[][[link classboost_1_1container_1_1static__vector_1a969626193cf92a99f3b03b1ac96044dc `operator[](size_type)`]][Returns reference to the i-th element. ]]
-[[ `const`][[link classboost_1_1container_1_1static__vector_1ab13ec3ee9ce46cf1700a2900bad77531 `operator[](size_type)`]][Returns const reference to the i-th element. ]]
-[[][[link classboost_1_1container_1_1static__vector_1a88bab6629556db28aac8a3e3142e3137 `front()`]][Returns reference to the first element. ]]
-[[ `const`][[link classboost_1_1container_1_1static__vector_1a2a1b6ca353a315e76c0f41cdb6440cf8 `front()`]][Returns const reference to the first element. ]]
-[[][[link classboost_1_1container_1_1static__vector_1a8b3295ab8d967460eb4ed6f87e827eb6 `back()`]][Returns reference to the last element. ]]
-[[ `const`][[link classboost_1_1container_1_1static__vector_1aa3a259c979e7755ae410f5b5250e2bd4 `back()`]][Returns const reference to the first element. ]]
-[[][[link classboost_1_1container_1_1static__vector_1aa1fed11b189287b9e671ab935332c5ce `data()`]][Pointer such that [^`[`[link classboost_1_1container_1_1static__vector_1aa1fed11b189287b9e671ab935332c5ce data()]`, `[link classboost_1_1container_1_1static__vector_1aa1fed11b189287b9e671ab935332c5ce data()]` + `[link classboost_1_1container_1_1static__vector_1af2a0e0148e73a8b6799ac7af3a26d6a3 size()]`)`] is a valid range. For a non-empty vector [^[link classboost_1_1container_1_1static__vector_1aa1fed11b189287b9e671ab935332c5ce data()]` == &`[link classboost_1_1container_1_1static__vector_1a88bab6629556db28aac8a3e3142e3137 front()]]. ]]
-[[ `const`][[link classboost_1_1container_1_1static__vector_1a3ac0ed788bfecd5103183f0b705d602d `data()`]][Const pointer such that [^`[`[link classboost_1_1container_1_1static__vector_1aa1fed11b189287b9e671ab935332c5ce data()]`, `[link classboost_1_1container_1_1static__vector_1aa1fed11b189287b9e671ab935332c5ce data()]` + `[link classboost_1_1container_1_1static__vector_1af2a0e0148e73a8b6799ac7af3a26d6a3 size()]`)`] is a valid range. For a non-empty vector [^[link classboost_1_1container_1_1static__vector_1aa1fed11b189287b9e671ab935332c5ce data()]` == &`[link classboost_1_1container_1_1static__vector_1a88bab6629556db28aac8a3e3142e3137 front()]]. ]]
-[[][[link classboost_1_1container_1_1static__vector_1aa2cd3e93cea4913f4c7a9e2e8c5f6628 `begin()`]][Returns iterator to the first element. ]]
-[[ `const`][[link classboost_1_1container_1_1static__vector_1a5ad66643c38c5c0c5754b010011c0024 `begin()`]][Returns const iterator to the first element. ]]
-[[ `const`][[link classboost_1_1container_1_1static__vector_1a33bd2d5cff22aa5a88050026367416a6 `cbegin()`]][Returns const iterator to the first element. ]]
-[[][[link classboost_1_1container_1_1static__vector_1a14db552be707d1da6b6a3298650316bc `end()`]][Returns iterator to the one after the last element. ]]
-[[ `const`][[link classboost_1_1container_1_1static__vector_1af619ba0152426c44cb59bd567c906139 `end()`]][Returns const iterator to the one after the last element. ]]
-[[ `const`][[link classboost_1_1container_1_1static__vector_1ad98b548743fab88322301e7a724ff73e `cend()`]][Returns const iterator to the one after the last element. ]]
-[[][[link classboost_1_1container_1_1static__vector_1a692f56e1145d27694f3f01462921e4ad `rbegin()`]][Returns reverse iterator to the first element of the reversed container. ]]
-[[ `const`][[link classboost_1_1container_1_1static__vector_1a2cb882180fb82fe20104656b08ad0127 `rbegin()`]][Returns const reverse iterator to the first element of the reversed container. ]]
-[[ `const`][[link classboost_1_1container_1_1static__vector_1a443d1701ea36063ebff8c350ed45bc20 `crbegin()`]][Returns const reverse iterator to the first element of the reversed container. ]]
-[[][[link classboost_1_1container_1_1static__vector_1ad1fe8aaeafefaf37ba49801f1f769c93 `rend()`]][Returns reverse iterator to the one after the last element of the reversed container. ]]
-[[ `const`][[link classboost_1_1container_1_1static__vector_1a660c0d82338d1c8c55546ece061cb7fa `rend()`]][Returns const reverse iterator to the one after the last element of the reversed container. ]]
-[[ `const`][[link classboost_1_1container_1_1static__vector_1a9a5f65095c083b516585d1054338e850 `crend()`]][Returns const reverse iterator to the one after the last element of the reversed container. ]]
-[[`static`][[link classboost_1_1container_1_1static__vector_1aabaf12d350a1b5457ba8ae4176819844 `capacity()`]][Returns container's capacity. ]]
-[[`static`][[link classboost_1_1container_1_1static__vector_1afe9bdc2c8fd236e17b946963f6497b83 `max_size()`]][Returns container's capacity. ]]
-[[ `const`][[link classboost_1_1container_1_1static__vector_1af2a0e0148e73a8b6799ac7af3a26d6a3 `size()`]][Returns the number of stored elements. ]]
-[[ `const`][[link classboost_1_1container_1_1static__vector_1aa408660722a22b80104613e28c514fc8 `empty()`]][Queries if the container contains elements. ]]
-[[][[link classboost_1_1container_1_1static__vector_1a4d89dc588ace1ce15c307a923a89f1b5 `shrink_to_fit()`]][Capacity is fixed so this call has no effects. ]]
-]
-
-[#classboost_1_1container_1_1static__vector_1ae0f7f391d06180aea516a6b03b3402c2]
-[section static_vector()]
-Constructs an empty [link classboost_1_1container_1_1static__vector static_vector].
-
-[heading Synopsis]
-[pre
-
-`static_vector``()`
-]
-
-[heading Throws]
-Nothing.
-
-[heading Complexity]
-Constant O(1).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1ab6461f56b1a46dc3e708e22d24b262c5]
-[section static_vector(size_type)]
-Constructs a [link classboost_1_1container_1_1static__vector static_vector] containing count default constructed Values.
-
-[heading Synopsis]
-[pre
-
-`static_vector``(`[^[link classboost_1_1container_1_1static__vector_1a4805729a79dc41f690c279636e20b31e size_type]] `count``)`
-]
-
-[heading Modifier(s)]
-``explicit ``[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[[^[link classboost_1_1container_1_1static__vector_1a4805729a79dc41f690c279636e20b31e size_type]]][ `count` ][The number of values which will be contained in the container.]]
-]
-[heading Precondition(s)]
-[^`count <= `[link classboost_1_1container_1_1static__vector_1aabaf12d350a1b5457ba8ae4176819844 capacity()]]
-
-[heading Throws]
-If Value's default constructor throws.
-
-[heading Complexity]
-Linear O(N).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a5f0a8f8d5a685d0d9ed9c54e202c7c3c]
-[section static_vector(size_type, value_type const &)]
-Constructs a [link classboost_1_1container_1_1static__vector static_vector] containing count copies of value.
-
-[heading Synopsis]
-[pre
-
-`static_vector``(`[^[link classboost_1_1container_1_1static__vector_1a4805729a79dc41f690c279636e20b31e size_type]] `count``,` [^[link classboost_1_1container_1_1static__vector_1a5985fc0bab97e6e2b923c9b97ef32b7e value_type]]` const &` `value``)`
-]
-
-[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[[^[link classboost_1_1container_1_1static__vector_1a4805729a79dc41f690c279636e20b31e size_type]]][ `count` ][The number of copies of a values that will be contained in the container. ]]
-[[[^[link classboost_1_1container_1_1static__vector_1a5985fc0bab97e6e2b923c9b97ef32b7e value_type]]` const &`][ `value` ][The value which will be used to copy construct values.]]
-]
-[heading Precondition(s)]
-[^`count <= `[link classboost_1_1container_1_1static__vector_1aabaf12d350a1b5457ba8ae4176819844 capacity()]]
-
-[heading Throws]
-If Value's copy constructor throws.
-
-[heading Complexity]
-Linear O(N).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a5e2c5c81fe53874667e3b9c2c07757b3]
-[section static_vector(Iterator, Iterator)]
-Constructs a [link classboost_1_1container_1_1static__vector static_vector] containing copy of a range [^`[first, last)`].
-
-[heading Synopsis]
-[pre
-`template<``typename Iterator``>`
-`static_vector``(``Iterator` `first``,` `Iterator` `last``)`
-]
-
-[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[`Iterator`][ `first` ][The iterator to the first element in range. ]]
-[[`Iterator`][ `last` ][The iterator to the one after the last element in range.]]
-]
-[heading Precondition(s)]
-
-
-* [^`distance(first, last) <= `[link classboost_1_1container_1_1static__vector_1aabaf12d350a1b5457ba8ae4176819844 capacity()]]
-* Iterator must meet the [^`ForwardTraversalIterator`] concept.
-
-
-
-[heading Throws]
-If Value's constructor taking a dereferenced Iterator throws.
-
-[heading Complexity]
-Linear O(N).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a48efc321954acc24a3a6f37a26c676f2]
-[section static_vector(static_vector const &)]
-Constructs a copy of other [link classboost_1_1container_1_1static__vector static_vector].
-
-[heading Synopsis]
-[pre
-
-`static_vector``(`[^[link classboost_1_1container_1_1static__vector static_vector]]` const &` `other``)`
-]
-
-[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[[^[link classboost_1_1container_1_1static__vector static_vector]]` const &`][ `other` ][The [link classboost_1_1container_1_1static__vector static_vector] which content will be copied to this one.]]
-]
-[heading Throws]
-If Value's copy constructor throws.
-
-[heading Complexity]
-Linear O(N).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1ae9a84810e47883c67b51dbaf760a6c1b]
-[section static_vector(static_vector<...> const &)]
-Constructs a copy of other [link classboost_1_1container_1_1static__vector static_vector].
-
-[heading Synopsis]
-[pre
-`template<``std::size_t C``,` `typename S``>`
-`static_vector``(`[^[link classboost_1_1container_1_1static__vector static_vector]]`< `[^[link classboost_1_1container_1_1static__vector_1a5985fc0bab97e6e2b923c9b97ef32b7e value_type]]`, C, S > const &` `other``)`
-]
-
-[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[[^[link classboost_1_1container_1_1static__vector static_vector]]`< `[^[link classboost_1_1container_1_1static__vector_1a5985fc0bab97e6e2b923c9b97ef32b7e value_type]]`, C, S > const &`][ `other` ][The [link classboost_1_1container_1_1static__vector static_vector] which content will be copied to this one.]]
-]
-[heading Precondition(s)]
-[^`other.size() <= `[link classboost_1_1container_1_1static__vector_1aabaf12d350a1b5457ba8ae4176819844 capacity()]].
-
-[heading Throws]
-If Value's copy constructor throws.
-
-[heading Complexity]
-Linear O(N).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a5e19b124c38ed45fbd5868349622c228]
-[section static_vector(static_vector &&)]
-Move constructor. Moves Values stored in the other [link classboost_1_1container_1_1static__vector static_vector] to this one.
-
-[heading Synopsis]
-[pre
-
-`static_vector``(`[^[link classboost_1_1container_1_1static__vector static_vector]]` &&` `other``)`
-]
-
-[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[[^[link classboost_1_1container_1_1static__vector static_vector]]` &&`][ `other` ][The [link classboost_1_1container_1_1static__vector static_vector] which content will be moved to this one.]]
-]
-[heading Throws]
-
-
-* If [^`boost::has_nothrow_move<Value>::value`] is [^`true`] and Value's move constructor throws.
-* If [^`boost::has_nothrow_move<Value>::value`] is [^`false`] and Value's copy constructor throws.
-
-
-
-[heading Complexity]
-Linear O(N).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1ab680dfce94853dbcbffa7c789199e668]
-[section static_vector(static_vector<...> &&)]
-Move constructor. Moves Values stored in the other [link classboost_1_1container_1_1static__vector static_vector] to this one.
-
-[heading Synopsis]
-[pre
-`template<``std::size_t C``,` `typename S``>`
-`static_vector``(`[^[link classboost_1_1container_1_1static__vector static_vector]]`< `[^[link classboost_1_1container_1_1static__vector_1a5985fc0bab97e6e2b923c9b97ef32b7e value_type]]`, C, S > &&` `other``)`
-]
-
-[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[[^[link classboost_1_1container_1_1static__vector static_vector]]`< `[^[link classboost_1_1container_1_1static__vector_1a5985fc0bab97e6e2b923c9b97ef32b7e value_type]]`, C, S > &&`][ `other` ][The [link classboost_1_1container_1_1static__vector static_vector] which content will be moved to this one.]]
-]
-[heading Precondition(s)]
-[^`other.size() <= `[link classboost_1_1container_1_1static__vector_1aabaf12d350a1b5457ba8ae4176819844 capacity()]]
-
-[heading Throws]
-
-
-* If [^`boost::has_nothrow_move<Value>::value`] is [^`true`] and Value's move constructor throws.
-* If [^`boost::has_nothrow_move<Value>::value`] is [^`false`] and Value's copy constructor throws.
-
-
-
-[heading Complexity]
-Linear O(N).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a047c909045c5fdc2dfba86d82bde57f5]
-[section ~static_vector()]
-Destructor. Destroys Values stored in this container.
-
-[heading Synopsis]
-[pre
-
-`~static_vector``()`
-]
-
-[heading Throws]
-Nothing
-
-[heading Complexity]
-Linear O(N).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a22aae352c5cfe7f9ccb0fda5a900ec98]
-[section operator=(const static_vector &)]
-Copy assigns Values stored in the other [link classboost_1_1container_1_1static__vector static_vector] to this one.
-
-[heading Synopsis]
-[pre
-
-[^[link classboost_1_1container_1_1static__vector static_vector]]` &` `operator=``(``const `[^[link classboost_1_1container_1_1static__vector static_vector]]` &` `other``)`
-]
-
-[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[`const `[^[link classboost_1_1container_1_1static__vector static_vector]]` &`][ `other` ][The [link classboost_1_1container_1_1static__vector static_vector] which content will be copied to this one.]]
-]
-[heading Throws]
-If Value's copy constructor or copy assignment throws.
-
-[heading Complexity]
-Linear O(N).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a58b56229fbbb996c394d89db80f8751d]
-[section operator=(static_vector<...> const &)]
-Copy assigns Values stored in the other [link classboost_1_1container_1_1static__vector static_vector] to this one.
-
-[heading Synopsis]
-[pre
-`template<``std::size_t C``,` `typename S``>`
-[^[link classboost_1_1container_1_1static__vector static_vector]]` &` `operator=``(`[^[link classboost_1_1container_1_1static__vector static_vector]]`< `[^[link classboost_1_1container_1_1static__vector_1a5985fc0bab97e6e2b923c9b97ef32b7e value_type]]`, C, S > const &` `other``)`
-]
-
-[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[[^[link classboost_1_1container_1_1static__vector static_vector]]`< `[^[link classboost_1_1container_1_1static__vector_1a5985fc0bab97e6e2b923c9b97ef32b7e value_type]]`, C, S > const &`][ `other` ][The [link classboost_1_1container_1_1static__vector static_vector] which content will be copied to this one.]]
-]
-[heading Precondition(s)]
-[^`other.size() <= `[link classboost_1_1container_1_1static__vector_1aabaf12d350a1b5457ba8ae4176819844 capacity()]]
-
-[heading Throws]
-If Value's copy constructor or copy assignment throws.
-
-[heading Complexity]
-Linear O(N).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a736084d326ffa4d50ec2dd15fd4dadca]
-[section operator=(static_vector &&)]
-Move assignment. Moves Values stored in the other [link classboost_1_1container_1_1static__vector static_vector] to this one.
-
-[heading Synopsis]
-[pre
-
-[^[link classboost_1_1container_1_1static__vector static_vector]]` &` `operator=``(`[^[link classboost_1_1container_1_1static__vector static_vector]]` &&` `other``)`
-]
-
-[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[[^[link classboost_1_1container_1_1static__vector static_vector]]` &&`][ `other` ][The [link classboost_1_1container_1_1static__vector static_vector] which content will be moved to this one.]]
-]
-[heading Throws]
-
-
-* If [^`boost::has_nothrow_move<Value>::value`] is [^`true`] and Value's move constructor or move assignment throws.
-* If [^`boost::has_nothrow_move<Value>::value`] is [^`false`] and Value's copy constructor or copy assignment throws.
-
-
-
-[heading Complexity]
-Linear O(N).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a03eaa538061845c7477ea5aba4f5fd7e]
-[section operator=(static_vector<...> &&)]
-Move assignment. Moves Values stored in the other [link classboost_1_1container_1_1static__vector static_vector] to this one.
-
-[heading Synopsis]
-[pre
-`template<``std::size_t C``,` `typename S``>`
-[^[link classboost_1_1container_1_1static__vector static_vector]]` &` `operator=``(`[^[link classboost_1_1container_1_1static__vector static_vector]]`< `[^[link classboost_1_1container_1_1static__vector_1a5985fc0bab97e6e2b923c9b97ef32b7e value_type]]`, C, S > &&` `other``)`
-]
-
-[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[[^[link classboost_1_1container_1_1static__vector static_vector]]`< `[^[link classboost_1_1container_1_1static__vector_1a5985fc0bab97e6e2b923c9b97ef32b7e value_type]]`, C, S > &&`][ `other` ][The [link classboost_1_1container_1_1static__vector static_vector] which content will be moved to this one.]]
-]
-[heading Precondition(s)]
-[^`other.size() <= `[link classboost_1_1container_1_1static__vector_1aabaf12d350a1b5457ba8ae4176819844 capacity()]]
-
-[heading Throws]
-
-
-* If [^`boost::has_nothrow_move<Value>::value`] is [^`true`] and Value's move constructor or move assignment throws.
-* If [^`boost::has_nothrow_move<Value>::value`] is [^`false`] and Value's copy constructor or copy assignment throws.
-
-
-
-[heading Complexity]
-Linear O(N).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a12cdeec047f6d310fe6a1746ddbf41d1]
-[section swap(static_vector &)]
-Swaps contents of the other [link classboost_1_1container_1_1static__vector static_vector] and this one.
-
-[heading Synopsis]
-[pre
-
-`void` `swap``(`[^[link classboost_1_1container_1_1static__vector static_vector]]` &` `other``)`
-]
-
-[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[[^[link classboost_1_1container_1_1static__vector static_vector]]` &`][ `other` ][The [link classboost_1_1container_1_1static__vector static_vector] which content will be swapped with this one's content.]]
-]
-[heading Throws]
-
-
-* If [^`boost::has_nothrow_move<Value>::value`] is [^`true`] and Value's move constructor or move assignment throws,
-* If [^`boost::has_nothrow_move<Value>::value`] is [^`false`] and Value's copy constructor or copy assignment throws,
-
-
-
-[heading Complexity]
-Linear O(N).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a7a668affb50dad8ae4c92bff03ae9f22]
-[section swap(static_vector<...> &)]
-Swaps contents of the other [link classboost_1_1container_1_1static__vector static_vector] and this one.
-
-[heading Synopsis]
-[pre
-`template<``std::size_t C``,` `typename S``>`
-`void` `swap``(`[^[link classboost_1_1container_1_1static__vector static_vector]]`< `[^[link classboost_1_1container_1_1static__vector_1a5985fc0bab97e6e2b923c9b97ef32b7e value_type]]`, C, S > &` `other``)`
-]
-
-[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[[^[link classboost_1_1container_1_1static__vector static_vector]]`< `[^[link classboost_1_1container_1_1static__vector_1a5985fc0bab97e6e2b923c9b97ef32b7e value_type]]`, C, S > &`][ `other` ][The [link classboost_1_1container_1_1static__vector static_vector] which content will be swapped with this one's content.]]
-]
-[heading Precondition(s)]
-[^`other.size() <= `[link classboost_1_1container_1_1static__vector_1aabaf12d350a1b5457ba8ae4176819844 capacity()]` && `[link classboost_1_1container_1_1static__vector_1af2a0e0148e73a8b6799ac7af3a26d6a3 size()]` <= other.capacity()`]
-
-[heading Throws]
-
-
-* If [^`boost::has_nothrow_move<Value>::value`] is [^`true`] and Value's move constructor or move assignment throws,
-* If [^`boost::has_nothrow_move<Value>::value`] is [^`false`] and Value's copy constructor or copy assignment throws,
-
-
-
-[heading Complexity]
-Linear O(N).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1acf7bf2c6ce597df2bfde495d9ee1bebd]
-[section resize(size_type)]
-Inserts or erases elements at the end such that the size becomes count. New elements are default constructed.
-
-[heading Synopsis]
-[pre
-
-`void` `resize``(`[^[link classboost_1_1container_1_1static__vector_1a4805729a79dc41f690c279636e20b31e size_type]] `count``)`
-]
-
-[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[[^[link classboost_1_1container_1_1static__vector_1a4805729a79dc41f690c279636e20b31e size_type]]][ `count` ][The number of elements which will be stored in the container.]]
-]
-[heading Precondition(s)]
-[^`count <= `[link classboost_1_1container_1_1static__vector_1aabaf12d350a1b5457ba8ae4176819844 capacity()]]
-
-[heading Throws]
-If Value's default constructor throws.
-
-[heading Complexity]
-Linear O(N).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a19cd77b2fdcda815b780e65b2fb66cc9]
-[section resize(size_type, value_type const &)]
-Inserts or erases elements at the end such that the size becomes count. New elements are copy constructed from value.
-
-[heading Synopsis]
-[pre
-
-`void` `resize``(`[^[link classboost_1_1container_1_1static__vector_1a4805729a79dc41f690c279636e20b31e size_type]] `count``,` [^[link classboost_1_1container_1_1static__vector_1a5985fc0bab97e6e2b923c9b97ef32b7e value_type]]` const &` `value``)`
-]
-
-[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[[^[link classboost_1_1container_1_1static__vector_1a4805729a79dc41f690c279636e20b31e size_type]]][ `count` ][The number of elements which will be stored in the container. ]]
-[[[^[link classboost_1_1container_1_1static__vector_1a5985fc0bab97e6e2b923c9b97ef32b7e value_type]]` const &`][ `value` ][The value used to copy construct the new element.]]
-]
-[heading Precondition(s)]
-[^`count <= `[link classboost_1_1container_1_1static__vector_1aabaf12d350a1b5457ba8ae4176819844 capacity()]]
-
-[heading Throws]
-If Value's copy constructor throws.
-
-[heading Complexity]
-Linear O(N).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a9553bdd8a9f3f98fdbdd3a5a46fb9474]
-[section reserve(size_type)]
-This call has no effect because the Capacity of this container is constant.
-
-[heading Synopsis]
-[pre
-
-`void` `reserve``(`[^[link classboost_1_1container_1_1static__vector_1a4805729a79dc41f690c279636e20b31e size_type]] `count``)`
-]
-
-[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[[^[link classboost_1_1container_1_1static__vector_1a4805729a79dc41f690c279636e20b31e size_type]]][ `count` ][The number of elements which the container should be able to contain.]]
-]
-[heading Precondition(s)]
-[^`count <= `[link classboost_1_1container_1_1static__vector_1aabaf12d350a1b5457ba8ae4176819844 capacity()]]
-
-[heading Throws]
-Nothing.
-
-[heading Complexity]
-Linear O(N).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1ae61c0bcedf9162c63c8b738ddfaed93d]
-[section push_back(value_type const &)]
-Adds a copy of value at the end.
-
-[heading Synopsis]
-[pre
-
-`void` `push_back``(`[^[link classboost_1_1container_1_1static__vector_1a5985fc0bab97e6e2b923c9b97ef32b7e value_type]]` const &` `value``)`
-]
-
-[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[[^[link classboost_1_1container_1_1static__vector_1a5985fc0bab97e6e2b923c9b97ef32b7e value_type]]` const &`][ `value` ][The value used to copy construct the new element.]]
-]
-[heading Precondition(s)]
-[^[link classboost_1_1container_1_1static__vector_1af2a0e0148e73a8b6799ac7af3a26d6a3 size()]` < `[link classboost_1_1container_1_1static__vector_1aabaf12d350a1b5457ba8ae4176819844 capacity()]]
-
-[heading Throws]
-If Value's copy constructor throws.
-
-[heading Complexity]
-Constant O(1).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a8d23922fd8d2bd57b8125253e8a06c4d]
-[section push_back(value_type &&)]
-Moves value to the end.
-
-[heading Synopsis]
-[pre
-
-`void` `push_back``(`[^[link classboost_1_1container_1_1static__vector_1a5985fc0bab97e6e2b923c9b97ef32b7e value_type]]` &&` `value``)`
-]
-
-[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[[^[link classboost_1_1container_1_1static__vector_1a5985fc0bab97e6e2b923c9b97ef32b7e value_type]]` &&`][ `value` ][The value to move construct the new element.]]
-]
-[heading Precondition(s)]
-[^[link classboost_1_1container_1_1static__vector_1af2a0e0148e73a8b6799ac7af3a26d6a3 size()]` < `[link classboost_1_1container_1_1static__vector_1aabaf12d350a1b5457ba8ae4176819844 capacity()]]
-
-[heading Throws]
-If Value's move constructor throws.
-
-[heading Complexity]
-Constant O(1).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a7be88e699c34a01953279e8f5b9deec4]
-[section pop_back()]
-Destroys last value and decreases the size.
-
-[heading Synopsis]
-[pre
-
-`void` `pop_back``()`
-]
-
-[heading Precondition(s)]
-[^`!empty()`]
-
-[heading Throws]
-Nothing by default.
-
-[heading Complexity]
-Constant O(1).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a949c881458809c08e0c6de6f54871fdf]
-[section insert(iterator, value_type const &)]
-Inserts a copy of element at position.
-
-[heading Synopsis]
-[pre
-
-[^[link classboost_1_1container_1_1static__vector_1ae9387f4d5cba4f4f87ad06222b46357e iterator]] `insert``(`[^[link classboost_1_1container_1_1static__vector_1ae9387f4d5cba4f4f87ad06222b46357e iterator]] `position``,` [^[link classboost_1_1container_1_1static__vector_1a5985fc0bab97e6e2b923c9b97ef32b7e value_type]]` const &` `value``)`
-]
-
-[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[[^[link classboost_1_1container_1_1static__vector_1ae9387f4d5cba4f4f87ad06222b46357e iterator]]][ `position` ][The position at which the new value will be inserted. ]]
-[[[^[link classboost_1_1container_1_1static__vector_1a5985fc0bab97e6e2b923c9b97ef32b7e value_type]]` const &`][ `value` ][The value used to copy construct the new element.]]
-]
-[heading Precondition(s)]
-
-
-* [^`position`] must be a valid iterator of [^`*this`] in range [^`[`[link classboost_1_1container_1_1static__vector_1aa2cd3e93cea4913f4c7a9e2e8c5f6628 begin()]`, `[link classboost_1_1container_1_1static__vector_1a14db552be707d1da6b6a3298650316bc end()]`]`].
-* [^[link classboost_1_1container_1_1static__vector_1af2a0e0148e73a8b6799ac7af3a26d6a3 size()]` < `[link classboost_1_1container_1_1static__vector_1aabaf12d350a1b5457ba8ae4176819844 capacity()]]
-
-
-
-[heading Throws]
-
-
-* If Value's copy constructor or copy assignment throws
-* If Value's move constructor or move assignment throws.
-
-
-
-[heading Complexity]
-Constant or linear.
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a93e722fcda2a5454901292642fcabfba]
-[section insert(iterator, value_type &&)]
-Inserts a move-constructed element at position.
-
-[heading Synopsis]
-[pre
-
-[^[link classboost_1_1container_1_1static__vector_1ae9387f4d5cba4f4f87ad06222b46357e iterator]] `insert``(`[^[link classboost_1_1container_1_1static__vector_1ae9387f4d5cba4f4f87ad06222b46357e iterator]] `position``,` [^[link classboost_1_1container_1_1static__vector_1a5985fc0bab97e6e2b923c9b97ef32b7e value_type]]` &&` `value``)`
-]
-
-[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[[^[link classboost_1_1container_1_1static__vector_1ae9387f4d5cba4f4f87ad06222b46357e iterator]]][ `position` ][The position at which the new value will be inserted. ]]
-[[[^[link classboost_1_1container_1_1static__vector_1a5985fc0bab97e6e2b923c9b97ef32b7e value_type]]` &&`][ `value` ][The value used to move construct the new element.]]
-]
-[heading Precondition(s)]
-
-
-* [^`position`] must be a valid iterator of [^`*this`] in range [^`[`[link classboost_1_1container_1_1static__vector_1aa2cd3e93cea4913f4c7a9e2e8c5f6628 begin()]`, `[link classboost_1_1container_1_1static__vector_1a14db552be707d1da6b6a3298650316bc end()]`]`].
-* [^[link classboost_1_1container_1_1static__vector_1af2a0e0148e73a8b6799ac7af3a26d6a3 size()]` < `[link classboost_1_1container_1_1static__vector_1aabaf12d350a1b5457ba8ae4176819844 capacity()]]
-
-
-
-[heading Throws]
-If Value's move constructor or move assignment throws.
-
-[heading Complexity]
-Constant or linear.
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a6381368d09a3b93c1bc6c28199f9810c]
-[section insert(iterator, size_type, value_type const &)]
-Inserts a count copies of value at position.
-
-[heading Synopsis]
-[pre
-
-[^[link classboost_1_1container_1_1static__vector_1ae9387f4d5cba4f4f87ad06222b46357e iterator]] `insert``(`[^[link classboost_1_1container_1_1static__vector_1ae9387f4d5cba4f4f87ad06222b46357e iterator]] `position``,`
- [^[link classboost_1_1container_1_1static__vector_1a4805729a79dc41f690c279636e20b31e size_type]] `count``,`
- [^[link classboost_1_1container_1_1static__vector_1a5985fc0bab97e6e2b923c9b97ef32b7e value_type]]` const &` `value``)`
-]
-
-[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[[^[link classboost_1_1container_1_1static__vector_1ae9387f4d5cba4f4f87ad06222b46357e iterator]]][ `position` ][The position at which new elements will be inserted. ]]
-[[[^[link classboost_1_1container_1_1static__vector_1a4805729a79dc41f690c279636e20b31e size_type]]][ `count` ][The number of new elements which will be inserted. ]]
-[[[^[link classboost_1_1container_1_1static__vector_1a5985fc0bab97e6e2b923c9b97ef32b7e value_type]]` const &`][ `value` ][The value used to copy construct new elements.]]
-]
-[heading Precondition(s)]
-
-
-* [^`position`] must be a valid iterator of [^`*this`] in range [^`[`[link classboost_1_1container_1_1static__vector_1aa2cd3e93cea4913f4c7a9e2e8c5f6628 begin()]`, `[link classboost_1_1container_1_1static__vector_1a14db552be707d1da6b6a3298650316bc end()]`]`].
-* [^[link classboost_1_1container_1_1static__vector_1af2a0e0148e73a8b6799ac7af3a26d6a3 size()]` + count <= `[link classboost_1_1container_1_1static__vector_1aabaf12d350a1b5457ba8ae4176819844 capacity()]]
-
-
-
-[heading Throws]
-
-
-* If Value's copy constructor or copy assignment throws.
-* If Value's move constructor or move assignment throws.
-
-
-
-[heading Complexity]
-Linear O(N).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a7f3daa5ea1faae1f75f2f33f8fc5c15c]
-[section insert(iterator, Iterator, Iterator)]
-Inserts a copy of a range [^`[first, last)`] at position.
-
-[heading Synopsis]
-[pre
-`template<``typename Iterator``>`
-[^[link classboost_1_1container_1_1static__vector_1ae9387f4d5cba4f4f87ad06222b46357e iterator]] `insert``(`[^[link classboost_1_1container_1_1static__vector_1ae9387f4d5cba4f4f87ad06222b46357e iterator]] `position``,`
- `Iterator` `first``,`
- `Iterator` `last``)`
-]
-
-[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[[^[link classboost_1_1container_1_1static__vector_1ae9387f4d5cba4f4f87ad06222b46357e iterator]]][ `position` ][The position at which new elements will be inserted. ]]
-[[`Iterator`][ `first` ][The iterator to the first element of a range used to construct new elements. ]]
-[[`Iterator`][ `last` ][The iterator to the one after the last element of a range used to construct new elements.]]
-]
-[heading Precondition(s)]
-
-
-* [^`position`] must be a valid iterator of [^`*this`] in range [^`[`[link classboost_1_1container_1_1static__vector_1aa2cd3e93cea4913f4c7a9e2e8c5f6628 begin()]`, `[link classboost_1_1container_1_1static__vector_1a14db552be707d1da6b6a3298650316bc end()]`]`].
-* [^`distance(first, last) <= `[link classboost_1_1container_1_1static__vector_1aabaf12d350a1b5457ba8ae4176819844 capacity()]]
-* [^`Iterator`] must meet the [^`ForwardTraversalIterator`] concept.
-
-
-
-[heading Throws]
-
-
-* If Value's constructor and assignment taking a dereferenced [^`Iterator`].
-* If Value's move constructor or move assignment throws.
-
-
-
-[heading Complexity]
-Linear O(N).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1aa8ba2711fd2390953a10f02eb464d269]
-[section erase(iterator)]
-Erases Value from position.
-
-[heading Synopsis]
-[pre
-
-[^[link classboost_1_1container_1_1static__vector_1ae9387f4d5cba4f4f87ad06222b46357e iterator]] `erase``(`[^[link classboost_1_1container_1_1static__vector_1ae9387f4d5cba4f4f87ad06222b46357e iterator]] `position``)`
-]
-
-[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[[^[link classboost_1_1container_1_1static__vector_1ae9387f4d5cba4f4f87ad06222b46357e iterator]]][ `position` ][The position of the element which will be erased from the container.]]
-]
-[heading Precondition(s)]
-[^`position`] must be a valid iterator of [^`*this`] in range [^`[`[link classboost_1_1container_1_1static__vector_1aa2cd3e93cea4913f4c7a9e2e8c5f6628 begin()]`, `[link classboost_1_1container_1_1static__vector_1a14db552be707d1da6b6a3298650316bc end()]`)`]
-
-[heading Throws]
-If Value's move assignment throws.
-
-[heading Complexity]
-Linear O(N).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a2fc879a077c834f4305efc21706e033c]
-[section erase(iterator, iterator)]
-Erases Values from a range [^`[first, last)`].
-
-[heading Synopsis]
-[pre
-
-[^[link classboost_1_1container_1_1static__vector_1ae9387f4d5cba4f4f87ad06222b46357e iterator]] `erase``(`[^[link classboost_1_1container_1_1static__vector_1ae9387f4d5cba4f4f87ad06222b46357e iterator]] `first``,` [^[link classboost_1_1container_1_1static__vector_1ae9387f4d5cba4f4f87ad06222b46357e iterator]] `last``)`
-]
-
-[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[[^[link classboost_1_1container_1_1static__vector_1ae9387f4d5cba4f4f87ad06222b46357e iterator]]][ `first` ][The position of the first element of a range which will be erased from the container. ]]
-[[[^[link classboost_1_1container_1_1static__vector_1ae9387f4d5cba4f4f87ad06222b46357e iterator]]][ `last` ][The position of the one after the last element of a range which will be erased from the container.]]
-]
-[heading Precondition(s)]
-
-
-* [^`first`] and [^`last`] must define a valid range
-* iterators must be in range [^`[`[link classboost_1_1container_1_1static__vector_1aa2cd3e93cea4913f4c7a9e2e8c5f6628 begin()]`, `[link classboost_1_1container_1_1static__vector_1a14db552be707d1da6b6a3298650316bc end()]`]`]
-
-
-
-[heading Throws]
-If Value's move assignment throws.
-
-[heading Complexity]
-Linear O(N).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a5f820fa73c4728fed1df89da341b98cb]
-[section assign(Iterator, Iterator)]
-Assigns a range [^`[first, last)`] of Values to this container.
-
-[heading Synopsis]
-[pre
-`template<``typename Iterator``>`
-`void` `assign``(``Iterator` `first``,` `Iterator` `last``)`
-]
-
-[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[`Iterator`][ `first` ][The iterator to the first element of a range used to construct new content of this container. ]]
-[[`Iterator`][ `last` ][The iterator to the one after the last element of a range used to construct new content of this container.]]
-]
-[heading Precondition(s)]
-[^`distance(first, last) <= `[link classboost_1_1container_1_1static__vector_1aabaf12d350a1b5457ba8ae4176819844 capacity()]]
-
-[heading Throws]
-If Value's copy constructor or copy assignment throws,
-
-[heading Complexity]
-Linear O(N).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1ac589c93c8b59e5712b0225a9b424f50f]
-[section assign(size_type, value_type const &)]
-Assigns a count copies of value to this container.
-
-[heading Synopsis]
-[pre
-
-`void` `assign``(`[^[link classboost_1_1container_1_1static__vector_1a4805729a79dc41f690c279636e20b31e size_type]] `count``,` [^[link classboost_1_1container_1_1static__vector_1a5985fc0bab97e6e2b923c9b97ef32b7e value_type]]` const &` `value``)`
-]
-
-[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[[^[link classboost_1_1container_1_1static__vector_1a4805729a79dc41f690c279636e20b31e size_type]]][ `count` ][The new number of elements which will be container in the container. ]]
-[[[^[link classboost_1_1container_1_1static__vector_1a5985fc0bab97e6e2b923c9b97ef32b7e value_type]]` const &`][ `value` ][The value which will be used to copy construct the new content.]]
-]
-[heading Precondition(s)]
-[^`count <= `[link classboost_1_1container_1_1static__vector_1aabaf12d350a1b5457ba8ae4176819844 capacity()]]
-
-[heading Throws]
-If Value's copy constructor or copy assignment throws.
-
-[heading Complexity]
-Linear O(N).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1ac00c9401b86fdbf8816540ce92329f40]
-[section emplace_back(Args &&...)]
-Inserts a Value constructed with [^`std::forward<Args>(args)`]... in the end of the container.
-
-[heading Synopsis]
-[pre
-`template<``class... Args``>`
-`void` `emplace_back``(``Args &&...` `args``)`
-]
-
-[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[`Args &&...`][ `args` ][The arguments of the constructor of the new element which will be created at the end of the container.]]
-]
-[heading Precondition(s)]
-[^[link classboost_1_1container_1_1static__vector_1af2a0e0148e73a8b6799ac7af3a26d6a3 size()]` < `[link classboost_1_1container_1_1static__vector_1aabaf12d350a1b5457ba8ae4176819844 capacity()]]
-
-[heading Throws]
-If in-place constructor throws or Value's move constructor throws.
-
-[heading Complexity]
-Constant O(1).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1ae06ce1a29316261d44920ca0d3836dad]
-[section emplace(iterator, Args &&...)]
-Inserts a Value constructed with [^`std::forward<Args>(args)`]... before position.
-
-[heading Synopsis]
-[pre
-`template<``class... Args``>`
-[^[link classboost_1_1container_1_1static__vector_1ae9387f4d5cba4f4f87ad06222b46357e iterator]] `emplace``(`[^[link classboost_1_1container_1_1static__vector_1ae9387f4d5cba4f4f87ad06222b46357e iterator]] `position``,` `Args &&...` `args``)`
-]
-
-[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[[^[link classboost_1_1container_1_1static__vector_1ae9387f4d5cba4f4f87ad06222b46357e iterator]]][ `position` ][The position at which new elements will be inserted. ]]
-[[`Args &&...`][ `args` ][The arguments of the constructor of the new element.]]
-]
-[heading Precondition(s)]
-
-
-* [^`position`] must be a valid iterator of [^`*this`] in range [^`[`[link classboost_1_1container_1_1static__vector_1aa2cd3e93cea4913f4c7a9e2e8c5f6628 begin()]`, `[link classboost_1_1container_1_1static__vector_1a14db552be707d1da6b6a3298650316bc end()]`]`]
-* [^[link classboost_1_1container_1_1static__vector_1af2a0e0148e73a8b6799ac7af3a26d6a3 size()]` < `[link classboost_1_1container_1_1static__vector_1aabaf12d350a1b5457ba8ae4176819844 capacity()]]
-
-
-
-[heading Throws]
-If in-place constructor throws or if Value's move constructor or move assignment throws.
-
-[heading Complexity]
-Constant or linear.
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a11ae430a28a7f9b9636f249bfc932a50]
-[section clear()]
-Removes all elements from the container.
-
-[heading Synopsis]
-[pre
-
-`void` `clear``()`
-]
-
-[heading Throws]
-Nothing.
-
-[heading Complexity]
-Constant O(1).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a2ab748bbf59967f381131dc2ded8878e]
-[section at(size_type)]
-Returns reference to the i-th element.
-
-[heading Synopsis]
-[pre
-
-[^[link classboost_1_1container_1_1static__vector_1a24cb3c33ddbeab8b6a82ac03a8482f16 reference]] `at``(`[^[link classboost_1_1container_1_1static__vector_1a4805729a79dc41f690c279636e20b31e size_type]] `i``)`
-]
-
-[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[[^[link classboost_1_1container_1_1static__vector_1a4805729a79dc41f690c279636e20b31e size_type]]][ `i` ][The element's index.]]
-]
-[heading Precondition(s)]
-[^`i < `[link classboost_1_1container_1_1static__vector_1af2a0e0148e73a8b6799ac7af3a26d6a3 size()]]
-
-[heading Returns]
-reference to the i-th element from the beginning of the container.
-[heading Throws]
-[^`std::out_of_range`] exception by default.
-
-[heading Complexity]
-Constant O(1).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1ad69bcb249614e043de9ad3c30848a046]
-[section at(size_type)]
-Returns const reference to the i-th element.
-
-[heading Synopsis]
-[pre
-
-[^[link classboost_1_1container_1_1static__vector_1a05ebdcd801a4e03109a709ab91981e4a const_reference]] `at``(`[^[link classboost_1_1container_1_1static__vector_1a4805729a79dc41f690c279636e20b31e size_type]] `i``)`
-]
-
-[heading Modifier(s)]
-``const ``[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[[^[link classboost_1_1container_1_1static__vector_1a4805729a79dc41f690c279636e20b31e size_type]]][ `i` ][The element's index.]]
-]
-[heading Precondition(s)]
-[^`i < `[link classboost_1_1container_1_1static__vector_1af2a0e0148e73a8b6799ac7af3a26d6a3 size()]]
-
-[heading Returns]
-const reference to the i-th element from the beginning of the container.
-[heading Throws]
-[^`std::out_of_range`] exception by default.
-
-[heading Complexity]
-Constant O(1).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a969626193cf92a99f3b03b1ac96044dc]
-[section operator\[\](size_type)]
-Returns reference to the i-th element.
-
-[heading Synopsis]
-[pre
-
-[^[link classboost_1_1container_1_1static__vector_1a24cb3c33ddbeab8b6a82ac03a8482f16 reference]] `operator[]``(`[^[link classboost_1_1container_1_1static__vector_1a4805729a79dc41f690c279636e20b31e size_type]] `i``)`
-]
-
-[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[[^[link classboost_1_1container_1_1static__vector_1a4805729a79dc41f690c279636e20b31e size_type]]][ `i` ][The element's index.]]
-]
-[heading Precondition(s)]
-[^`i < `[link classboost_1_1container_1_1static__vector_1af2a0e0148e73a8b6799ac7af3a26d6a3 size()]]
-
-[heading Returns]
-reference to the i-th element from the beginning of the container.
-[heading Throws]
-Nothing by default.
-
-[heading Complexity]
-Constant O(1).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1ab13ec3ee9ce46cf1700a2900bad77531]
-[section operator\[\](size_type)]
-Returns const reference to the i-th element.
-
-[heading Synopsis]
-[pre
-
-[^[link classboost_1_1container_1_1static__vector_1a05ebdcd801a4e03109a709ab91981e4a const_reference]] `operator[]``(`[^[link classboost_1_1container_1_1static__vector_1a4805729a79dc41f690c279636e20b31e size_type]] `i``)`
-]
-
-[heading Modifier(s)]
-``const ``[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[[^[link classboost_1_1container_1_1static__vector_1a4805729a79dc41f690c279636e20b31e size_type]]][ `i` ][The element's index.]]
-]
-[heading Precondition(s)]
-[^`i < `[link classboost_1_1container_1_1static__vector_1af2a0e0148e73a8b6799ac7af3a26d6a3 size()]]
-
-[heading Returns]
-const reference to the i-th element from the beginning of the container.
-[heading Throws]
-Nothing by default.
-
-[heading Complexity]
-Constant O(1).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a88bab6629556db28aac8a3e3142e3137]
-[section front()]
-Returns reference to the first element.
-
-[heading Synopsis]
-[pre
-
-[^[link classboost_1_1container_1_1static__vector_1a24cb3c33ddbeab8b6a82ac03a8482f16 reference]] `front``()`
-]
-
-[heading Precondition(s)]
-[^`!empty`]()
-
-[heading Returns]
-reference to the first element from the beginning of the container.
-[heading Throws]
-Nothing by default.
-
-[heading Complexity]
-Constant O(1).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a2a1b6ca353a315e76c0f41cdb6440cf8]
-[section front()]
-Returns const reference to the first element.
-
-[heading Synopsis]
-[pre
-
-[^[link classboost_1_1container_1_1static__vector_1a05ebdcd801a4e03109a709ab91981e4a const_reference]] `front``()`
-]
-
-[heading Modifier(s)]
-``const ``[heading Precondition(s)]
-[^`!empty`]()
-
-[heading Returns]
-const reference to the first element from the beginning of the container.
-[heading Throws]
-Nothing by default.
-
-[heading Complexity]
-Constant O(1).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a8b3295ab8d967460eb4ed6f87e827eb6]
-[section back()]
-Returns reference to the last element.
-
-[heading Synopsis]
-[pre
-
-[^[link classboost_1_1container_1_1static__vector_1a24cb3c33ddbeab8b6a82ac03a8482f16 reference]] `back``()`
-]
-
-[heading Precondition(s)]
-[^`!empty`]()
-
-[heading Returns]
-reference to the last element from the beginning of the container.
-[heading Throws]
-Nothing by default.
-
-[heading Complexity]
-Constant O(1).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1aa3a259c979e7755ae410f5b5250e2bd4]
-[section back()]
-Returns const reference to the first element.
-
-[heading Synopsis]
-[pre
-
-[^[link classboost_1_1container_1_1static__vector_1a05ebdcd801a4e03109a709ab91981e4a const_reference]] `back``()`
-]
-
-[heading Modifier(s)]
-``const ``[heading Precondition(s)]
-[^`!empty`]()
-
-[heading Returns]
-const reference to the last element from the beginning of the container.
-[heading Throws]
-Nothing by default.
-
-[heading Complexity]
-Constant O(1).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1aa1fed11b189287b9e671ab935332c5ce]
-[section data()]
-Pointer such that [^`[`[link classboost_1_1container_1_1static__vector_1aa1fed11b189287b9e671ab935332c5ce data()]`, `[link classboost_1_1container_1_1static__vector_1aa1fed11b189287b9e671ab935332c5ce data()]` + `[link classboost_1_1container_1_1static__vector_1af2a0e0148e73a8b6799ac7af3a26d6a3 size()]`)`] is a valid range. For a non-empty vector [^[link classboost_1_1container_1_1static__vector_1aa1fed11b189287b9e671ab935332c5ce data()]` == &`[link classboost_1_1container_1_1static__vector_1a88bab6629556db28aac8a3e3142e3137 front()]].
-
-[heading Synopsis]
-[pre
-
-`Value *` `data``()`
-]
-
-[heading Throws]
-Nothing.
-
-[heading Complexity]
-Constant O(1).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a3ac0ed788bfecd5103183f0b705d602d]
-[section data()]
-Const pointer such that [^`[`[link classboost_1_1container_1_1static__vector_1aa1fed11b189287b9e671ab935332c5ce data()]`, `[link classboost_1_1container_1_1static__vector_1aa1fed11b189287b9e671ab935332c5ce data()]` + `[link classboost_1_1container_1_1static__vector_1af2a0e0148e73a8b6799ac7af3a26d6a3 size()]`)`] is a valid range. For a non-empty vector [^[link classboost_1_1container_1_1static__vector_1aa1fed11b189287b9e671ab935332c5ce data()]` == &`[link classboost_1_1container_1_1static__vector_1a88bab6629556db28aac8a3e3142e3137 front()]].
-
-[heading Synopsis]
-[pre
-
-`const Value *` `data``()`
-]
-
-[heading Modifier(s)]
-``const ``[heading Throws]
-Nothing.
-
-[heading Complexity]
-Constant O(1).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1aa2cd3e93cea4913f4c7a9e2e8c5f6628]
-[section begin()]
-Returns iterator to the first element.
-
-[heading Synopsis]
-[pre
-
-[^[link classboost_1_1container_1_1static__vector_1ae9387f4d5cba4f4f87ad06222b46357e iterator]] `begin``()`
-]
-
-[heading Returns]
-iterator to the first element contained in the vector.
-[heading Throws]
-Nothing.
-
-[heading Complexity]
-Constant O(1).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a5ad66643c38c5c0c5754b010011c0024]
-[section begin()]
-Returns const iterator to the first element.
-
-[heading Synopsis]
-[pre
-
-[^[link classboost_1_1container_1_1static__vector_1af9d23146b9e766c7ea2453a48ca63eae const_iterator]] `begin``()`
-]
-
-[heading Modifier(s)]
-``const ``[heading Returns]
-const_iterator to the first element contained in the vector.
-[heading Throws]
-Nothing.
-
-[heading Complexity]
-Constant O(1).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a33bd2d5cff22aa5a88050026367416a6]
-[section cbegin()]
-Returns const iterator to the first element.
-
-[heading Synopsis]
-[pre
-
-[^[link classboost_1_1container_1_1static__vector_1af9d23146b9e766c7ea2453a48ca63eae const_iterator]] `cbegin``()`
-]
-
-[heading Modifier(s)]
-``const ``[heading Returns]
-const_iterator to the first element contained in the vector.
-[heading Throws]
-Nothing.
-
-[heading Complexity]
-Constant O(1).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a14db552be707d1da6b6a3298650316bc]
-[section end()]
-Returns iterator to the one after the last element.
-
-[heading Synopsis]
-[pre
-
-[^[link classboost_1_1container_1_1static__vector_1ae9387f4d5cba4f4f87ad06222b46357e iterator]] `end``()`
-]
-
-[heading Returns]
-iterator pointing to the one after the last element contained in the vector.
-[heading Throws]
-Nothing.
-
-[heading Complexity]
-Constant O(1).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1af619ba0152426c44cb59bd567c906139]
-[section end()]
-Returns const iterator to the one after the last element.
-
-[heading Synopsis]
-[pre
-
-[^[link classboost_1_1container_1_1static__vector_1af9d23146b9e766c7ea2453a48ca63eae const_iterator]] `end``()`
-]
-
-[heading Modifier(s)]
-``const ``[heading Returns]
-const_iterator pointing to the one after the last element contained in the vector.
-[heading Throws]
-Nothing.
-
-[heading Complexity]
-Constant O(1).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1ad98b548743fab88322301e7a724ff73e]
-[section cend()]
-Returns const iterator to the one after the last element.
-
-[heading Synopsis]
-[pre
-
-[^[link classboost_1_1container_1_1static__vector_1af9d23146b9e766c7ea2453a48ca63eae const_iterator]] `cend``()`
-]
-
-[heading Modifier(s)]
-``const ``[heading Returns]
-const_iterator pointing to the one after the last element contained in the vector.
-[heading Throws]
-Nothing.
-
-[heading Complexity]
-Constant O(1).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a692f56e1145d27694f3f01462921e4ad]
-[section rbegin()]
-Returns reverse iterator to the first element of the reversed container.
-
-[heading Synopsis]
-[pre
-
-[^[link classboost_1_1container_1_1static__vector_1ab143d0cd51d29d261dd705a957d9969a reverse_iterator]] `rbegin``()`
-]
-
-[heading Returns]
-reverse_iterator pointing to the beginning of the reversed [link classboost_1_1container_1_1static__vector static_vector].
-[heading Throws]
-Nothing.
-
-[heading Complexity]
-Constant O(1).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a2cb882180fb82fe20104656b08ad0127]
-[section rbegin()]
-Returns const reverse iterator to the first element of the reversed container.
-
-[heading Synopsis]
-[pre
-
-[^[link classboost_1_1container_1_1static__vector_1aedca56b1b3e41ef352f7cc5c4dabdcd4 const_reverse_iterator]] `rbegin``()`
-]
-
-[heading Modifier(s)]
-``const ``[heading Returns]
-const_reverse_iterator pointing to the beginning of the reversed [link classboost_1_1container_1_1static__vector static_vector].
-[heading Throws]
-Nothing.
-
-[heading Complexity]
-Constant O(1).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a443d1701ea36063ebff8c350ed45bc20]
-[section crbegin()]
-Returns const reverse iterator to the first element of the reversed container.
-
-[heading Synopsis]
-[pre
-
-[^[link classboost_1_1container_1_1static__vector_1aedca56b1b3e41ef352f7cc5c4dabdcd4 const_reverse_iterator]] `crbegin``()`
-]
-
-[heading Modifier(s)]
-``const ``[heading Returns]
-const_reverse_iterator pointing to the beginning of the reversed [link classboost_1_1container_1_1static__vector static_vector].
-[heading Throws]
-Nothing.
-
-[heading Complexity]
-Constant O(1).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1ad1fe8aaeafefaf37ba49801f1f769c93]
-[section rend()]
-Returns reverse iterator to the one after the last element of the reversed container.
-
-[heading Synopsis]
-[pre
-
-[^[link classboost_1_1container_1_1static__vector_1ab143d0cd51d29d261dd705a957d9969a reverse_iterator]] `rend``()`
-]
-
-[heading Returns]
-reverse_iterator pointing to the one after the last element of the reversed [link classboost_1_1container_1_1static__vector static_vector].
-[heading Throws]
-Nothing.
-
-[heading Complexity]
-Constant O(1).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a660c0d82338d1c8c55546ece061cb7fa]
-[section rend()]
-Returns const reverse iterator to the one after the last element of the reversed container.
-
-[heading Synopsis]
-[pre
-
-[^[link classboost_1_1container_1_1static__vector_1aedca56b1b3e41ef352f7cc5c4dabdcd4 const_reverse_iterator]] `rend``()`
-]
-
-[heading Modifier(s)]
-``const ``[heading Returns]
-const_reverse_iterator pointing to the one after the last element of the reversed [link classboost_1_1container_1_1static__vector static_vector].
-[heading Throws]
-Nothing.
-
-[heading Complexity]
-Constant O(1).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a9a5f65095c083b516585d1054338e850]
-[section crend()]
-Returns const reverse iterator to the one after the last element of the reversed container.
-
-[heading Synopsis]
-[pre
-
-[^[link classboost_1_1container_1_1static__vector_1aedca56b1b3e41ef352f7cc5c4dabdcd4 const_reverse_iterator]] `crend``()`
-]
-
-[heading Modifier(s)]
-``const ``[heading Returns]
-const_reverse_iterator pointing to the one after the last element of the reversed [link classboost_1_1container_1_1static__vector static_vector].
-[heading Throws]
-Nothing.
-
-[heading Complexity]
-Constant O(1).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1aabaf12d350a1b5457ba8ae4176819844]
-[section capacity()]
-Returns container's capacity.
-
-[heading Synopsis]
-[pre
-
-[^[link classboost_1_1container_1_1static__vector_1a4805729a79dc41f690c279636e20b31e size_type]] `capacity``()`
-]
-
-[heading Modifier(s)]
-``static ``[heading Returns]
-container's capacity.
-[heading Throws]
-Nothing.
-
-[heading Complexity]
-Constant O(1).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1afe9bdc2c8fd236e17b946963f6497b83]
-[section max_size()]
-Returns container's capacity.
-
-[heading Synopsis]
-[pre
-
-[^[link classboost_1_1container_1_1static__vector_1a4805729a79dc41f690c279636e20b31e size_type]] `max_size``()`
-]
-
-[heading Modifier(s)]
-``static ``[heading Returns]
-container's capacity.
-[heading Throws]
-Nothing.
-
-[heading Complexity]
-Constant O(1).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1af2a0e0148e73a8b6799ac7af3a26d6a3]
-[section size()]
-Returns the number of stored elements.
-
-[heading Synopsis]
-[pre
-
-[^[link classboost_1_1container_1_1static__vector_1a4805729a79dc41f690c279636e20b31e size_type]] `size``()`
-]
-
-[heading Modifier(s)]
-``const ``[heading Returns]
-Number of elements contained in the container.
-[heading Throws]
-Nothing.
-
-[heading Complexity]
-Constant O(1).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1aa408660722a22b80104613e28c514fc8]
-[section empty()]
-Queries if the container contains elements.
-
-[heading Synopsis]
-[pre
-
-`bool` `empty``()`
-]
-
-[heading Modifier(s)]
-``const ``[heading Returns]
-true if the number of elements contained in the container is equal to 0.
-[heading Throws]
-Nothing.
-
-[heading Complexity]
-Constant O(1).
-
-[endsect]
-
-[#classboost_1_1container_1_1static__vector_1a4d89dc588ace1ce15c307a923a89f1b5]
-[section shrink_to_fit()]
-Capacity is fixed so this call has no effects.
-
-[heading Synopsis]
-[pre
-
-`void` `shrink_to_fit``()`
-]
-
-[heading Throws]
-Nothing.
-
-[heading Complexity]
-Constant O(1).
-
-[endsect]
-
-[endsect]
-

Deleted: sandbox/varray/doc/generated/static_vector_non_member.qbk
==============================================================================
--- sandbox/varray/doc/generated/static_vector_non_member.qbk 2013-01-26 22:36:10 EST (Sat, 26 Jan 2013)
+++ (empty file)
@@ -1,205 +0,0 @@
-[/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically]
-[/ Generated from xml/group__static__vector__non__member.xml]
-[section:group__static__vector__non__member static_vector non-member functions (boost::container::)]
-[heading Functions]
-[table
-[[Function][Description]]
-[[[link group__static__vector__non__member_1ga15ee6a27a72ac7e54851e55098e2c463 `operator==(static_vector<...> const &, static_vector<...> const &)`]][Checks if contents of two static_vectors are equal. ]]
-[[[link group__static__vector__non__member_1gacb9b370bfc7d1652821e2b0c96b57a59 `operator!=(static_vector<...> const &, static_vector<...> const &)`]][Checks if contents of two static_vectors are not equal. ]]
-[[[link group__static__vector__non__member_1ga60109c1f2d34d115b9eb43a7878fa000 `operator<(static_vector<...> const &, static_vector<...> const &)`]][Lexicographically compares static_vectors. ]]
-[[[link group__static__vector__non__member_1ga8223e957e30a57debc636213334634dc `operator>(static_vector<...> const &, static_vector<...> const &)`]][Lexicographically compares static_vectors. ]]
-[[[link group__static__vector__non__member_1ga55c998e59f82229852f3452fc3d7626f `operator<=(static_vector<...> const &, static_vector<...> const &)`]][Lexicographically compares static_vectors. ]]
-[[[link group__static__vector__non__member_1ga0f02374ff1234b74ba9c68cd5247cd0d `operator>=(static_vector<...> const &, static_vector<...> const &)`]][Lexicographically compares static_vectors. ]]
-[[[link group__static__vector__non__member_1gaee8c63afec740b9ce45f5814561988f9 `swap(static_vector<...> &, static_vector<...> &)`]][Swaps contents of two static_vectors. ]]
-]
-
-[#group__static__vector__non__member_1ga15ee6a27a72ac7e54851e55098e2c463]
-[section operator==(static_vector<...> const &, static_vector<...> const &)]
-Checks if contents of two static_vectors are equal.
-
-[heading Synopsis]
-[pre
-`template<``typename V``,`
- `std::size_t C1``,`
- `typename S1``,`
- `std::size_t C2``,`
- `typename S2``>`
-`bool boost::container::operator==``(``static_vector< V, C1, S1 > const &` `x``,` `static_vector< V, C2, S2 > const &` `y``)`
-]
-
-[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[`static_vector< V, C1, S1 > const &`][ `x` ][The first [link classboost_1_1container_1_1static__vector static_vector]. ]]
-[[`static_vector< V, C2, S2 > const &`][ `y` ][The second [link classboost_1_1container_1_1static__vector static_vector].]]
-]
-[heading Returns]
-[^`true`] if containers have the same size and elements in both containers are equal.
-[heading Complexity]
-Linear O(N).
-
-[endsect]
-
-[#group__static__vector__non__member_1gacb9b370bfc7d1652821e2b0c96b57a59]
-[section operator!=(static_vector<...> const &, static_vector<...> const &)]
-Checks if contents of two static_vectors are not equal.
-
-[heading Synopsis]
-[pre
-`template<``typename V``,`
- `std::size_t C1``,`
- `typename S1``,`
- `std::size_t C2``,`
- `typename S2``>`
-`bool boost::container::operator!=``(``static_vector< V, C1, S1 > const &` `x``,` `static_vector< V, C2, S2 > const &` `y``)`
-]
-
-[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[`static_vector< V, C1, S1 > const &`][ `x` ][The first [link classboost_1_1container_1_1static__vector static_vector]. ]]
-[[`static_vector< V, C2, S2 > const &`][ `y` ][The second [link classboost_1_1container_1_1static__vector static_vector].]]
-]
-[heading Returns]
-[^`true`] if containers have different size or elements in both containers are not equal.
-[heading Complexity]
-Linear O(N).
-
-[endsect]
-
-[#group__static__vector__non__member_1ga60109c1f2d34d115b9eb43a7878fa000]
-[section operator<(static_vector<...> const &, static_vector<...> const &)]
-Lexicographically compares static_vectors.
-
-[heading Synopsis]
-[pre
-`template<``typename V``,`
- `std::size_t C1``,`
- `typename S1``,`
- `std::size_t C2``,`
- `typename S2``>`
-`bool boost::container::operator<``(``static_vector< V, C1, S1 > const &` `x``,` `static_vector< V, C2, S2 > const &` `y``)`
-]
-
-[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[`static_vector< V, C1, S1 > const &`][ `x` ][The first [link classboost_1_1container_1_1static__vector static_vector]. ]]
-[[`static_vector< V, C2, S2 > const &`][ `y` ][The second [link classboost_1_1container_1_1static__vector static_vector].]]
-]
-[heading Returns]
-[^`true`] if x compares lexicographically less than y.
-[heading Complexity]
-Linear O(N).
-
-[endsect]
-
-[#group__static__vector__non__member_1ga8223e957e30a57debc636213334634dc]
-[section operator>(static_vector<...> const &, static_vector<...> const &)]
-Lexicographically compares static_vectors.
-
-[heading Synopsis]
-[pre
-`template<``typename V``,`
- `std::size_t C1``,`
- `typename S1``,`
- `std::size_t C2``,`
- `typename S2``>`
-`bool boost::container::operator>``(``static_vector< V, C1, S1 > const &` `x``,` `static_vector< V, C2, S2 > const &` `y``)`
-]
-
-[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[`static_vector< V, C1, S1 > const &`][ `x` ][The first [link classboost_1_1container_1_1static__vector static_vector]. ]]
-[[`static_vector< V, C2, S2 > const &`][ `y` ][The second [link classboost_1_1container_1_1static__vector static_vector].]]
-]
-[heading Returns]
-[^`true`] if y compares lexicographically less than x.
-[heading Complexity]
-Linear O(N).
-
-[endsect]
-
-[#group__static__vector__non__member_1ga55c998e59f82229852f3452fc3d7626f]
-[section operator<=(static_vector<...> const &, static_vector<...> const &)]
-Lexicographically compares static_vectors.
-
-[heading Synopsis]
-[pre
-`template<``typename V``,`
- `std::size_t C1``,`
- `typename S1``,`
- `std::size_t C2``,`
- `typename S2``>`
-`bool boost::container::operator<=``(``static_vector< V, C1, S1 > const &` `x``,` `static_vector< V, C2, S2 > const &` `y``)`
-]
-
-[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[`static_vector< V, C1, S1 > const &`][ `x` ][The first [link classboost_1_1container_1_1static__vector static_vector]. ]]
-[[`static_vector< V, C2, S2 > const &`][ `y` ][The second [link classboost_1_1container_1_1static__vector static_vector].]]
-]
-[heading Returns]
-[^`true`] if y don't compare lexicographically less than x.
-[heading Complexity]
-Linear O(N).
-
-[endsect]
-
-[#group__static__vector__non__member_1ga0f02374ff1234b74ba9c68cd5247cd0d]
-[section operator>=(static_vector<...> const &, static_vector<...> const &)]
-Lexicographically compares static_vectors.
-
-[heading Synopsis]
-[pre
-`template<``typename V``,`
- `std::size_t C1``,`
- `typename S1``,`
- `std::size_t C2``,`
- `typename S2``>`
-`bool boost::container::operator>=``(``static_vector< V, C1, S1 > const &` `x``,` `static_vector< V, C2, S2 > const &` `y``)`
-]
-
-[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[`static_vector< V, C1, S1 > const &`][ `x` ][The first [link classboost_1_1container_1_1static__vector static_vector]. ]]
-[[`static_vector< V, C2, S2 > const &`][ `y` ][The second [link classboost_1_1container_1_1static__vector static_vector].]]
-]
-[heading Returns]
-[^`true`] if x don't compare lexicographically less than y.
-[heading Complexity]
-Linear O(N).
-
-[endsect]
-
-[#group__static__vector__non__member_1gaee8c63afec740b9ce45f5814561988f9]
-[section swap(static_vector<...> &, static_vector<...> &)]
-Swaps contents of two static_vectors.
-
-[heading Description]
-This function calls [link classboost_1_1container_1_1static__vector_1a12cdeec047f6d310fe6a1746ddbf41d1 static_vector::swap()].[heading Synopsis]
-[pre
-`template<``typename V``,`
- `std::size_t C1``,`
- `typename S1``,`
- `std::size_t C2``,`
- `typename S2``>`
-`void boost::container::swap``(``static_vector< V, C1, S1 > &` `x``,` `static_vector< V, C2, S2 > &` `y``)`
-]
-
-[heading Parameter(s)]
-[table
-[[Type][Name][Description]]
-[[`static_vector< V, C1, S1 > &`][ `x` ][The first [link classboost_1_1container_1_1static__vector static_vector]. ]]
-[[`static_vector< V, C2, S2 > &`][ `y` ][The second [link classboost_1_1container_1_1static__vector static_vector].]]
-]
-[heading Complexity]
-Linear O(N).
-
-[endsect]
-
-[endsect]
-

Deleted: sandbox/varray/doc/generated/strategy_allocator_adaptor.qbk
==============================================================================
--- sandbox/varray/doc/generated/strategy_allocator_adaptor.qbk 2013-01-26 22:36:10 EST (Sat, 26 Jan 2013)
+++ (empty file)
@@ -1,31 +0,0 @@
-[/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically]
-[/ Generated from xml/structboost_1_1container_1_1strategy_1_1allocator__adaptor.xml]
-[#structboost_1_1container_1_1strategy_1_1allocator__adaptor]
-[section:boost_container_strategy_allocator_adaptor boost::container::strategy::allocator_adaptor]
-
-'''<indexterm><primary>boost</primary></indexterm><indexterm><primary>container</primary></indexterm><indexterm><primary>strategy</primary></indexterm><indexterm><primary>allocator_adaptor</primary></indexterm>'''
-The strategy adapting info from passed Allocator.
-
-[heading Description]
-This strategy defines the same types that are defined in the Allocator.
-
-[heading Header]
-`#include <boost/container/static_vector.hpp>`
-
-[heading Synopsis]
-[pre
-`template<``typename Allocator``>`
-`struct allocator_adaptor`
-`{`
-` // ...`
-`};`
-]
-
-[heading Template parameter(s)]
-[table
-[[Parameter] [Description]]
-[[`Allocator`][The Allocator which will be adapted. ]]
-]
-
-[endsect]
-

Deleted: sandbox/varray/doc/generated/strategy_def.qbk
==============================================================================
--- sandbox/varray/doc/generated/strategy_def.qbk 2013-01-26 22:36:10 EST (Sat, 26 Jan 2013)
+++ (empty file)
@@ -1,28 +0,0 @@
-[/ Generated by doxygen_xml2qbk, don't change, will be overwritten automatically]
-[/ Generated from xml/structboost_1_1container_1_1strategy_1_1def.xml]
-[#structboost_1_1container_1_1strategy_1_1def]
-[section:boost_container_strategy_def boost::container::strategy::def]
-
-'''<indexterm><primary>boost</primary></indexterm><indexterm><primary>container</primary></indexterm><indexterm><primary>strategy</primary></indexterm><indexterm><primary>def</primary></indexterm>'''
-The default strategy.
-
-[heading Header]
-`#include <boost/container/static_vector.hpp>`
-
-[heading Synopsis]
-[pre
-`template<``typename Value``>`
-`struct def`
-`{`
-` // ...`
-`};`
-]
-
-[heading Template parameter(s)]
-[table
-[[Parameter] [Description]]
-[[`Value`][Type of element stored in the container. ]]
-]
-
-[endsect]
-

Deleted: sandbox/varray/doc/static_vector.qbk
==============================================================================
--- sandbox/varray/doc/static_vector.qbk 2013-01-26 22:36:10 EST (Sat, 26 Jan 2013)
+++ (empty file)
@@ -1,69 +0,0 @@
-[/
- / Copyright (c) 2012 Adam Wulkiewicz
- / Copyright (c) 2012 Andrew Hundt
- /
- / 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)
- /]
-
-[library StaticVector
- [quickbook 1.5]
- [authors [Wulkiewicz, Adam], [Hundt, Andrew]]
- [copyright 2012 Adam Wulkiewicz, 2011-2012 Andrew Hundt]
- [id static_vector]
- [category containers]
- [purpose Containers library]
- [license
- 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])
- ]
-]
-
-[section:introduction Introduction]
-
-`static_vector` is a sequence container like `boost::container::vector` with contiguous storage that can
-change in size, along with the static allocation, low overhead, and fixed capacity of `boost::array`.
-
-The number of elements in a static_vector may vary dynamically up to a fixed capacity
-because elements are stored within the object itself similarly to an array. However, objects are
-initialized as they are inserted into static_vector unlike C arrays or `std::array` which must construct
-all elements on instantiation. The behavior of static_vector enables the use of statically allocated
-elements in cases with complex object lifetime requirements that would otherwise not be trivially
-possible. For example values stored in `static_vector` may not define default constructor or copy constructor.
-
-[heading Example]
-[import ../example/static_vector_example.cpp]
-[static_vector_example_cpp]
-
-[heading Implementation details]
-Like containers in `Boost.Container` library, this container implements move semantics and C++11 `std::vector`
-methods like `emplace()`. Implementation uses Boost.Move library and it works on compilers without r-value
-references suport. If the compiler doesn't support variadic templates `BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS`
-`emplace()` and `emplace_back()` overloads are generated.
-
-[heading Runtime Complexity]
-* random access to elements
-* constant time insertion and removal of elements at the end
-* linear time insertion and removal of elements at the beginning or in the middle.
-
-[heading Use Cases]
-static_vector is well suited for use in a buffer, the internal implementation of of other
-classes, or use cases where there is a fixed limit to the number of elements that must be stored.
-Embedded and realtime applications where allocation either may not be available or acceptable
-are a particular case where static_vector can be beneficial.
-
-Exceptions can be disabled for cases where they are either not supported or desired.
-
-[endsect]
-
-[section:reference Reference]
-
-[include generated/static_vector.qbk]
-[include generated/static_vector_non_member.qbk]
-[section:reference Predefined strategies]
-[include generated/strategy_def.qbk]
-[include generated/strategy_allocator_adaptor.qbk]
-[endsect]
-
-[endsect]

Copied: sandbox/varray/doc/varray.qbk (from r82619, /sandbox/varray/doc/static_vector.qbk)
==============================================================================
--- /sandbox/varray/doc/static_vector.qbk (original)
+++ sandbox/varray/doc/varray.qbk 2013-01-26 22:36:10 EST (Sat, 26 Jan 2013)
@@ -1,5 +1,5 @@
 [/
- / Copyright (c) 2012 Adam Wulkiewicz
+ / Copyright (c) 2012-2013 Adam Wulkiewicz
  / Copyright (c) 2012 Andrew Hundt
  /
  / Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -9,8 +9,8 @@
 [library StaticVector
     [quickbook 1.5]
     [authors [Wulkiewicz, Adam], [Hundt, Andrew]]
- [copyright 2012 Adam Wulkiewicz, 2011-2012 Andrew Hundt]
- [id static_vector]
+ [copyright 2012-2013 Adam Wulkiewicz, 2011-2013 Andrew Hundt]
+ [id varray]
     [category containers]
     [purpose Containers library]
     [license
@@ -22,19 +22,19 @@
 
 [section:introduction Introduction]
 
-`static_vector` is a sequence container like `boost::container::vector` with contiguous storage that can
+`varray` is a sequence container like `boost::container::vector` with contiguous storage that can
 change in size, along with the static allocation, low overhead, and fixed capacity of `boost::array`.
 
-The number of elements in a static_vector may vary dynamically up to a fixed capacity
+The number of elements in a varray may vary dynamically up to a fixed capacity
 because elements are stored within the object itself similarly to an array. However, objects are
-initialized as they are inserted into static_vector unlike C arrays or `std::array` which must construct
-all elements on instantiation. The behavior of static_vector enables the use of statically allocated
+initialized as they are inserted into varray unlike C arrays or `std::array` which must construct
+all elements on instantiation. The behavior of varray enables the use of statically allocated
 elements in cases with complex object lifetime requirements that would otherwise not be trivially
-possible. For example values stored in `static_vector` may not define default constructor or copy constructor.
+possible. For example values stored in `varray` may not define default constructor or copy constructor.
 
 [heading Example]
-[import ../example/static_vector_example.cpp]
-[static_vector_example_cpp]
+[import ../example/varray_example.cpp]
+[varray_example_cpp]
 
 [heading Implementation details]
 Like containers in `Boost.Container` library, this container implements move semantics and C++11 `std::vector`
@@ -48,10 +48,10 @@
 * linear time insertion and removal of elements at the beginning or in the middle.
 
 [heading Use Cases]
-static_vector is well suited for use in a buffer, the internal implementation of of other
+varray is well suited for use in a buffer, the internal implementation of of other
 classes, or use cases where there is a fixed limit to the number of elements that must be stored.
 Embedded and realtime applications where allocation either may not be available or acceptable
-are a particular case where static_vector can be beneficial.
+are a particular case where varray can be beneficial.
 
 Exceptions can be disabled for cases where they are either not supported or desired.
 
@@ -59,8 +59,8 @@
 
 [section:reference Reference]
 
-[include generated/static_vector.qbk]
-[include generated/static_vector_non_member.qbk]
+[include generated/varray.qbk]
+[include generated/varray_non_member.qbk]
 [section:reference Predefined strategies]
 [include generated/strategy_def.qbk]
 [include generated/strategy_allocator_adaptor.qbk]

Added: sandbox/varray/example/Jamfile.v2
==============================================================================
--- (empty file)
+++ sandbox/varray/example/Jamfile.v2 2013-01-26 22:36:10 EST (Sat, 26 Jan 2013)
@@ -0,0 +1,23 @@
+# Boost.Container varray
+#
+# Copyright (c) 2012-2013 Adam Wulkiewicz, Lodz, Poland.
+#
+# 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)
+
+import testing ;
+
+project boost-container-varray-examples
+ :
+ requirements
+ <include>..
+ <include>../..
+ <toolset>msvc:<asynch-exceptions>on
+ ;
+
+exe varray_example : varray_example.cpp ;
+exe varray_set_example : varray_set_example.cpp ;
+exe times : times.cpp ;
+#exe interprocess : interprocess.cpp ;
+#exe bench_static_vector : bench_static_vector.cpp ;

Modified: sandbox/varray/example/bench_static_vector.cpp
==============================================================================
--- sandbox/varray/example/bench_static_vector.cpp (original)
+++ sandbox/varray/example/bench_static_vector.cpp 2013-01-26 22:36:10 EST (Sat, 26 Jan 2013)
@@ -1,7 +1,7 @@
 
 // benchmark based on: http://cpp-next.com/archive/2010/10/howards-stl-move-semantics-benchmark/
 /**
- * @file static_vector_set_example.cpp
+ * @file varray_set_example.cpp
  * @date Aug 14, 2011
  * @author Andrew Hundt <ATHundt_at_[hidden]>
  *
@@ -11,11 +11,11 @@
  * accompanying file LICENSE_1_0.txt or copy at
  * http://www.boost.org/LICENSE_1_0.txt)
  *
- * @brief static_vector_benchmark.cpp compares the performance of boost::container::static_vector to boost::container::vector
+ * @brief varray_benchmark.cpp compares the performance of boost::container::varray to boost::container::vector
  *
  */
  
-#include "boost/container/static_vector.hpp"
+#include "boost/container/varray.hpp"
 #include "boost/container/vector.hpp"
 #include <vector>
 #include <iostream>
@@ -90,13 +90,13 @@
     try {
         std::cout << "N = " << N << "\n\n";
         
- std::cout << "static_vector benchmark:\n";
- cpu_times tsv = time_it<boost::container::static_vector<boost::container::static_vector<std::size_t,N>,N > >();
+ std::cout << "varray benchmark:\n";
+ cpu_times tsv = time_it<boost::container::varray<boost::container::varray<std::size_t,N>,N > >();
         
         std::cout << "vector benchmark\n";
         cpu_times tv = time_it<boost::container::vector<boost::container::vector<std::size_t> > >();
         
- std::cout << "static_vector/vector total time comparison:"
+ std::cout << "varray/vector total time comparison:"
         << "\n wall = " << ((double)tsv.wall/(double)tv.wall)
         << "\n user = " << ((double)tsv.user/(double)tv.user)
         << "\n system = " << ((double)tsv.system/(double)tv.system)

Modified: sandbox/varray/example/interprocess.cpp
==============================================================================
--- sandbox/varray/example/interprocess.cpp (original)
+++ sandbox/varray/example/interprocess.cpp 2013-01-26 22:36:10 EST (Sat, 26 Jan 2013)
@@ -6,7 +6,7 @@
 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-#include <boost/container/static_vector.hpp>
+#include <boost/container/varray.hpp>
 
 #include <boost/interprocess/managed_shared_memory.hpp>
 #include <boost/interprocess/allocators/allocator.hpp>
@@ -20,16 +20,16 @@
 {
     static void allocate_failed()
     {
- boost::container::static_vector_detail::default_strategy<V>::allocate_failed();
+ boost::container::container_detail::strategy::def<V>::allocate_failed();
     }
 };
 
 using namespace boost::interprocess;
-using namespace boost::container;
+using namespace boost::container::container_detail;
 
 typedef interprocess_strategy<int, managed_shared_memory::segment_manager> ShmemStrategy;
 
-typedef static_vector<int, 100, ShmemStrategy> MyVector;
+typedef varray<int, 100, ShmemStrategy> MyVector;
 
 //For parent process argc == 1, for child process argc > 1
 int main(int argc, char *argv[])

Deleted: sandbox/varray/example/static_vector_example.cpp
==============================================================================
--- sandbox/varray/example/static_vector_example.cpp 2013-01-26 22:36:10 EST (Sat, 26 Jan 2013)
+++ (empty file)
@@ -1,40 +0,0 @@
-/**
- * @file static_vector_example.cpp
- * @date Aug 14, 2011
- * @author Andrew Hundt <ATHundt_at_[hidden]>
- *
- * (C) 2011-2012 Andrew Hundt <ATHundt_at_[hidden]>
- *
- * 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)
- *
- * @brief static_vector_example.cpp demonstrates the use of boost::container::static_vector
- *
- */
-
-//[static_vector_example_cpp
-
-// static_vector_example.cpp
-
-#include <boost/container/static_vector.hpp>
-
-int main(int argc, char** argv){
-
- // static_vector of ints, fixed capacity: 3
- boost::container::static_vector<int, 3> three; // size: 0
-
- three.push_back(1); // size: 1
- three.push_back(2); // size: 2
- three.push_back(3); // size: 3
-
- //three.reserve(4); // no effect, fixed capacity: 3
- //three.push_back(3); // size: 4, behavior depends on strategy, assert by default
-
- three.pop_back(); // size: 2
- three.shrink_to_fit(); // no effect, fixed capacity: 3
-
- return 0;
-}
-
-//]
\ No newline at end of file

Deleted: sandbox/varray/example/static_vector_set_example.cpp
==============================================================================
--- sandbox/varray/example/static_vector_set_example.cpp 2013-01-26 22:36:10 EST (Sat, 26 Jan 2013)
+++ (empty file)
@@ -1,69 +0,0 @@
-/**
- * @file static_vector_set_example.cpp
- * @date Aug 14, 2011
- * @author Andrew Hundt <ATHundt_at_[hidden]>
- *
- * (C) 2011-2012 Andrew Hundt <ATHundt_at_[hidden]>
- *
- * 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)
- *
- * @brief static_vector_set_example.cpp demonstrates the use of boost::container::static_vector
- *
- */
-
-#include <iostream>
-#include <string>
-#include <set>
-#include "boost/container/static_vector.hpp"
-
-namespace boost
-{
-#ifdef BOOST_NO_EXCEPTIONS
-void throw_exception(std::exception const & e){}; // user defined
-#endif // BOOST_NO_EXCEPTIONS
-} // namespace boost
-
-using namespace std;
-using namespace boost;
-
-typedef boost::container::static_vector<std::set<std::size_t>,3> ThreeSetType;
-
-void print(std::size_t value){
- cout << " " << value;
-}
-
-
-void printSet(std::set<std::size_t> value){
- cout << " (";
- std::for_each(value.begin(),value.end(),print);
- cout << ")";
-}
-
-ThreeSetType makeThreeSet(){
- ThreeSetType t;
- std::set<std::size_t> s;
- s.insert(3);
- t.push_back(s);
- s.insert(2);
- t.push_back(s);
- s.insert(1);
- t.push_back(s);
- return t;
-}
-
-int main(int argc, char** argv){
- cout << "Creating threeSet, a boost::container::static_vector of 3 std::set objects containing (3), (3 2), and (3 2 1), respectively" << std::endl;
- ThreeSetType threeSet = makeThreeSet();
- cout << "threeSet Values:" << std::endl;
- std::for_each(threeSet.begin(),threeSet.end(),printSet);
-
- cout << std::endl;
- cout << "Sorting threeSet:" << std::endl;
- std::sort(threeSet.begin(), threeSet.end());
- std::for_each(threeSet.begin(),threeSet.end(),printSet);
-
- cout << std::endl << "Success!" << std::endl;
-
-}
\ No newline at end of file

Modified: sandbox/varray/example/times.cpp
==============================================================================
--- sandbox/varray/example/times.cpp (original)
+++ sandbox/varray/example/times.cpp 2013-01-26 22:36:10 EST (Sat, 26 Jan 2013)
@@ -7,7 +7,7 @@
 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-#include<boost/container/static_vector.hpp>
+#include<boost/container/varray.hpp>
 
 #include <boost/timer.hpp>
 #include <fstream>
@@ -43,14 +43,14 @@
 template <typename V, size_t N>
 size_t test(size_t count)
 {
- static_vector<V, N> sv;
+ varray<V, N> sv;
     for ( size_t i = 0 ; i < sv.capacity() ; ++i)
         sv.push_back(V(i));
 
     size_t dummy = 0;
     for ( size_t i = 0 ; i < count ; ++i )
     {
- static_vector<V, N> sv2(sv);
+ varray<V, N> sv2(sv);
         sv2.assign(sv.begin(), sv.end());
         dummy += sv2[0];
     }

Copied: sandbox/varray/example/varray_example.cpp (from r82619, /sandbox/varray/example/static_vector_example.cpp)
==============================================================================
--- /sandbox/varray/example/static_vector_example.cpp (original)
+++ sandbox/varray/example/varray_example.cpp 2013-01-26 22:36:10 EST (Sat, 26 Jan 2013)
@@ -1,5 +1,5 @@
 /**
- * @file static_vector_example.cpp
+ * @file varray_example.cpp
  * @date Aug 14, 2011
  * @author Andrew Hundt <ATHundt_at_[hidden]>
  *
@@ -9,20 +9,20 @@
  * accompanying file LICENSE_1_0.txt or copy at
  * http://www.boost.org/LICENSE_1_0.txt)
  *
- * @brief static_vector_example.cpp demonstrates the use of boost::container::static_vector
+ * @brief varray_example.cpp demonstrates the use of boost::container::varray
  *
  */
  
-//[static_vector_example_cpp
+//[varray_example_cpp
 
-// static_vector_example.cpp
+// varray_example.cpp
 
-#include <boost/container/static_vector.hpp>
+#include <boost/container/varray.hpp>
 
 int main(int argc, char** argv){
   
- // static_vector of ints, fixed capacity: 3
- boost::container::static_vector<int, 3> three; // size: 0
+ // varray of ints, fixed capacity: 3
+ boost::container::varray<int, 3> three; // size: 0
 
   three.push_back(1); // size: 1
   three.push_back(2); // size: 2
@@ -37,4 +37,4 @@
   return 0;
 }
 
-//]
\ No newline at end of file
+//]

Copied: sandbox/varray/example/varray_set_example.cpp (from r82619, /sandbox/varray/example/static_vector_set_example.cpp)
==============================================================================
--- /sandbox/varray/example/static_vector_set_example.cpp (original)
+++ sandbox/varray/example/varray_set_example.cpp 2013-01-26 22:36:10 EST (Sat, 26 Jan 2013)
@@ -1,5 +1,5 @@
 /**
- * @file static_vector_set_example.cpp
+ * @file varray_set_example.cpp
  * @date Aug 14, 2011
  * @author Andrew Hundt <ATHundt_at_[hidden]>
  *
@@ -9,14 +9,14 @@
  * accompanying file LICENSE_1_0.txt or copy at
  * http://www.boost.org/LICENSE_1_0.txt)
  *
- * @brief static_vector_set_example.cpp demonstrates the use of boost::container::static_vector
+ * @brief varray_set_example.cpp demonstrates the use of boost::container::varray
  *
  */
  
 #include <iostream>
 #include <string>
 #include <set>
-#include "boost/container/static_vector.hpp"
+#include "boost/container/varray.hpp"
 
 namespace boost
 {
@@ -28,7 +28,7 @@
 using namespace std;
 using namespace boost;
 
-typedef boost::container::static_vector<std::set<std::size_t>,3> ThreeSetType;
+typedef boost::container::varray<std::set<std::size_t>,3> ThreeSetType;
   
 void print(std::size_t value){
   cout << " " << value;
@@ -54,7 +54,7 @@
 }
 
 int main(int argc, char** argv){
- cout << "Creating threeSet, a boost::container::static_vector of 3 std::set objects containing (3), (3 2), and (3 2 1), respectively" << std::endl;
+ cout << "Creating threeSet, a boost::container::varray of 3 std::set objects containing (3), (3 2), and (3 2 1), respectively" << std::endl;
   ThreeSetType threeSet = makeThreeSet();
   cout << "threeSet Values:" << std::endl;
   std::for_each(threeSet.begin(),threeSet.end(),printSet);
@@ -66,4 +66,4 @@
   
   cout << std::endl << "Success!" << std::endl;
   
-}
\ No newline at end of file
+}

Modified: sandbox/varray/test/Jamfile.v2
==============================================================================
--- sandbox/varray/test/Jamfile.v2 (original)
+++ sandbox/varray/test/Jamfile.v2 2013-01-26 22:36:10 EST (Sat, 26 Jan 2013)
@@ -1,6 +1,6 @@
-# Boost.Container StaticVector
+# Boost.Container varray
 #
-# Copyright (c) 2012 Adam Wulkiewicz, Lodz, Poland.
+# Copyright (c) 2012-2013 Adam Wulkiewicz, Lodz, Poland.
 #
 # Use, modification and distribution is subject to the Boost Software License,
 # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -8,7 +8,7 @@
 
 import testing ;
 
-project boost-container-static_vector-test
+project boost-container-varray-test
     :
     requirements
         <include>.
@@ -17,12 +17,12 @@
         <toolset>msvc:<asynch-exceptions>on
     ;
 
-test-suite boost-container-static_vector
- : [ run static_vector_test.cpp ]
+test-suite boost-container-varray
+ : [ run varray_test.cpp ]
     ;
 
-test-suite boost-container-static_vector_interprocess
- : [ run static_vector_interprocess_test.cpp /boost/thread//boost_thread
+test-suite boost-container-varray_interprocess
+ : [ run varray_interprocess_test.cpp /boost/thread//boost_thread
         : # additional args
         : # test-files
         : # requirements

Deleted: sandbox/varray/test/static_vector_interprocess_test.cpp
==============================================================================
--- sandbox/varray/test/static_vector_interprocess_test.cpp 2013-01-26 22:36:10 EST (Sat, 26 Jan 2013)
+++ (empty file)
@@ -1,89 +0,0 @@
-// Boost.Container StaticVector
-// Unit Test
-
-// Copyright (c) 2012 Adam Wulkiewicz, Lodz, Poland.
-// Copyright (c) 2012 Andrew Hundt.
-
-// 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)
-
-#ifdef BOOST_SINGLE_HEADER_UTF
-#define BOOST_TEST_MODULE static_vector_tests
-#include <boost/test/unit_test.hpp>
-#else // BOOST_SINGLE_HEADER_UTF
-#include <boost/test/included/test_exec_monitor.hpp>
-#include <boost/test/impl/execution_monitor.ipp>
-#endif // BOOST_SINGLE_HEADER_UTF
-
-#include "static_vector_test.hpp"
-
-#include <boost/interprocess/managed_shared_memory.hpp>
-#include <boost/interprocess/allocators/allocator.hpp>
-#include <algorithm>
-
-template <typename V, typename SegmentManager>
-struct interprocess_strategy
- : public strategy::allocator_adaptor<
- boost::interprocess::allocator<V, SegmentManager>
- >
-{};
-
-template <typename T, size_t N>
-void test_interprocess(T const& t)
-{
- namespace bi = boost::interprocess;
- struct shm_remove
- {
- shm_remove() { bi::shared_memory_object::remove("shared_memory"); }
- ~shm_remove(){ bi::shared_memory_object::remove("shared_memory"); }
- } remover;
-
- bi::managed_shared_memory shmem(bi::create_only, "shared_memory", 10000 + sizeof(T) * N);
-
- typedef static_vector<
- T, N,
- interprocess_strategy<T, bi::managed_shared_memory::segment_manager>
- > SV;
-
- SV * sv_ptr = shmem.construct<SV>("my_object")();
-
- for ( size_t i = 0 ; i < N ; ++i )
- sv_ptr->push_back(T(N - i));
-
- std::sort(sv_ptr->begin(), sv_ptr->end());
-
- for ( size_t i = 0 ; i < N ; ++i )
- BOOST_CHECK((*sv_ptr)[i] == T(i + 1));
-
- {
- T * p = sv_ptr->data();
- for ( size_t i = 0 ; p != sv_ptr->data() + sv_ptr->size() ; ++p, ++i )
- BOOST_CHECK(*p == T(i + 1));
- }
-
- sv_ptr->assign(N/2, t);
- for ( size_t i = 0 ; i < N/2 ; ++i )
- BOOST_CHECK(sv_ptr->at(i) == t);
-
- shmem.destroy_ptr(sv_ptr);
-}
-
-#ifdef BOOST_SINGLE_HEADER_UTF
-BOOST_AUTO_TEST_CASE(static_vector_test)
-#else // BOOST_SINGLE_HEADER_UTF
-int test_main(int, char* [])
-#endif // BOOST_SINGLE_HEADER_UTF
-{
- BOOST_CHECK(counting_value::count() == 0);
-
- test_interprocess<int, 10>(50);
- test_interprocess<value_nd, 10>(value_nd(50));
- test_interprocess<counting_value, 10>(counting_value(50));
- BOOST_CHECK(counting_value::count() == 0);
- test_interprocess<shptr_value, 10>(shptr_value(50));
-
-#ifndef BOOST_SINGLE_HEADER_UTF
- return 0;
-#endif // BOOST_SINGLE_HEADER_UTF
-}

Deleted: sandbox/varray/test/static_vector_test.cpp
==============================================================================
--- sandbox/varray/test/static_vector_test.cpp 2013-01-26 22:36:10 EST (Sat, 26 Jan 2013)
+++ (empty file)
@@ -1,762 +0,0 @@
-// Boost.Container StaticVector
-// Unit Test
-
-// Copyright (c) 2012 Adam Wulkiewicz, Lodz, Poland.
-// Copyright (c) 2012 Andrew Hundt.
-
-// 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)
-
-#ifdef BOOST_SINGLE_HEADER_UTF
-#define BOOST_TEST_MODULE static_vector_tests
-#include <boost/test/unit_test.hpp>
-#else // BOOST_SINGLE_HEADER_UTF
-#include <boost/test/included/test_exec_monitor.hpp>
-#include <boost/test/impl/execution_monitor.ipp>
-#endif // BOOST_SINGLE_HEADER_UTF
-
-// TODO: Disable parts of the unit test that should not run when BOOST_NO_EXCEPTIONS
-// if exceptions are enabled there must be a user defined throw_exception function
-#ifdef BOOST_NO_EXCEPTIONS
-namespace boost {
- void throw_exception(std::exception const & e){}; // user defined
-} // namespace boost
-#endif // BOOST_NO_EXCEPTIONS
-
-#include <vector>
-#include <list>
-
-#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
-#include <boost/container/vector.hpp>
-#include <boost/container/stable_vector.hpp>
-#endif
-
-#include "static_vector_test.hpp"
-
-template <typename V>
-struct bad_alloc_strategy
- : public strategy::def<V>
-{
- static void allocate_failed()
- {
- BOOST_THROW_EXCEPTION(std::bad_alloc());
- }
-};
-
-template <typename T, size_t N>
-void test_ctor_ndc()
-{
- static_vector<T, N> s;
- BOOST_CHECK_EQUAL(s.size() , 0);
- BOOST_CHECK(s.capacity() == N);
-#ifndef BOOST_NO_EXCEPTIONS
- BOOST_CHECK_THROW( s.at(0), std::out_of_range );
-#endif // BOOST_NO_EXCEPTIONS
-}
-
-template <typename T, size_t N>
-void test_ctor_nc(size_t n)
-{
- static_vector<T, N> s(n);
- BOOST_CHECK(s.size() == n);
- BOOST_CHECK(s.capacity() == N);
-#ifndef BOOST_NO_EXCEPTIONS
- BOOST_CHECK_THROW( s.at(n), std::out_of_range );
-#endif // BOOST_NO_EXCEPTIONS
- if ( 1 < n )
- {
- T val10(10);
- s[0] = val10;
- BOOST_CHECK(T(10) == s[0]);
- BOOST_CHECK(T(10) == s.at(0));
- T val20(20);
- s.at(1) = val20;
- BOOST_CHECK(T(20) == s[1]);
- BOOST_CHECK(T(20) == s.at(1));
- }
-}
-
-template <typename T, size_t N>
-void test_ctor_nd(size_t n, T const& v)
-{
- static_vector<T, N> s(n, v);
- BOOST_CHECK(s.size() == n);
- BOOST_CHECK(s.capacity() == N);
-#ifndef BOOST_NO_EXCEPTIONS
- BOOST_CHECK_THROW( s.at(n), std::out_of_range );
-#endif // BOOST_NO_EXCEPTIONS
- if ( 1 < n )
- {
- BOOST_CHECK(v == s[0]);
- BOOST_CHECK(v == s.at(0));
- BOOST_CHECK(v == s[1]);
- BOOST_CHECK(v == s.at(1));
- s[0] = T(10);
- BOOST_CHECK(T(10) == s[0]);
- BOOST_CHECK(T(10) == s.at(0));
- s.at(1) = T(20);
- BOOST_CHECK(T(20) == s[1]);
- BOOST_CHECK(T(20) == s.at(1));
- }
-}
-
-template <typename T, size_t N>
-void test_resize_nc(size_t n)
-{
- static_vector<T, N> s;
-
- s.resize(n);
- BOOST_CHECK(s.size() == n);
- BOOST_CHECK(s.capacity() == N);
-#ifndef BOOST_NO_EXCEPTIONS
- BOOST_CHECK_THROW( s.at(n), std::out_of_range );
-#endif // BOOST_NO_EXCEPTIONS
- if ( 1 < n )
- {
- T val10(10);
- s[0] = val10;
- BOOST_CHECK(T(10) == s[0]);
- BOOST_CHECK(T(10) == s.at(0));
- T val20(20);
- s.at(1) = val20;
- BOOST_CHECK(T(20) == s[1]);
- BOOST_CHECK(T(20) == s.at(1));
- }
-}
-
-template <typename T, size_t N>
-void test_resize_nd(size_t n, T const& v)
-{
- static_vector<T, N> s;
-
- s.resize(n, v);
- BOOST_CHECK(s.size() == n);
- BOOST_CHECK(s.capacity() == N);
-#ifndef BOOST_NO_EXCEPTIONS
- BOOST_CHECK_THROW( s.at(n), std::out_of_range );
-#endif // BOOST_NO_EXCEPTIONS
- if ( 1 < n )
- {
- BOOST_CHECK(v == s[0]);
- BOOST_CHECK(v == s.at(0));
- BOOST_CHECK(v == s[1]);
- BOOST_CHECK(v == s.at(1));
- s[0] = T(10);
- BOOST_CHECK(T(10) == s[0]);
- BOOST_CHECK(T(10) == s.at(0));
- s.at(1) = T(20);
- BOOST_CHECK(T(20) == s[1]);
- BOOST_CHECK(T(20) == s.at(1));
- }
-}
-
-template <typename T, size_t N>
-void test_push_back_nd()
-{
- static_vector<T, N> s;
-
- BOOST_CHECK(s.size() == 0);
-#ifndef BOOST_NO_EXCEPTIONS
- BOOST_CHECK_THROW( s.at(0), std::out_of_range );
-#endif // BOOST_NO_EXCEPTIONS
-
- for ( size_t i = 0 ; i < N ; ++i )
- {
- T t(i);
- s.push_back(t);
- BOOST_CHECK(s.size() == i + 1);
-#ifndef BOOST_NO_EXCEPTIONS
- BOOST_CHECK_THROW( s.at(i + 1), std::out_of_range );
-#endif // BOOST_NO_EXCEPTIONS
- BOOST_CHECK(T(i) == s.at(i));
- BOOST_CHECK(T(i) == s[i]);
- BOOST_CHECK(T(i) == s.back());
- BOOST_CHECK(T(0) == s.front());
- BOOST_CHECK(T(i) == *(s.data() + i));
- }
-}
-
-template <typename T, size_t N>
-void test_pop_back_nd()
-{
- static_vector<T, N> s;
-
- for ( size_t i = 0 ; i < N ; ++i )
- {
- T t(i);
- s.push_back(t);
- }
-
- for ( size_t i = N ; i > 1 ; --i )
- {
- s.pop_back();
- BOOST_CHECK(s.size() == i - 1);
-#ifndef BOOST_NO_EXCEPTIONS
- BOOST_CHECK_THROW( s.at(i - 1), std::out_of_range );
-#endif // BOOST_NO_EXCEPTIONS
- BOOST_CHECK(T(i - 2) == s.at(i - 2));
- BOOST_CHECK(T(i - 2) == s[i - 2]);
- BOOST_CHECK(T(i - 2) == s.back());
- BOOST_CHECK(T(0) == s.front());
- }
-}
-
-template <typename It1, typename It2>
-void test_compare_ranges(It1 first1, It1 last1, It2 first2, It2 last2)
-{
- BOOST_CHECK(std::distance(first1, last1) == std::distance(first2, last2));
- for ( ; first1 != last1 && first2 != last2 ; ++first1, ++first2 )
- BOOST_CHECK(*first1 == *first2);
-}
-
-template <typename T, size_t N, typename C>
-void test_copy_and_assign(C const& c)
-{
- {
- static_vector<T, N> s(c.begin(), c.end());
- BOOST_CHECK(s.size() == c.size());
- test_compare_ranges(s.begin(), s.end(), c.begin(), c.end());
- }
- {
- static_vector<T, N> s;
- BOOST_CHECK(0 == s.size());
- s.assign(c.begin(), c.end());
- BOOST_CHECK(s.size() == c.size());
- test_compare_ranges(s.begin(), s.end(), c.begin(), c.end());
- }
-}
-
-template <typename T, size_t N>
-void test_copy_and_assign_nd(T const& val)
-{
- static_vector<T, N> s;
- std::vector<T> v;
- std::list<T> l;
-
- for ( size_t i = 0 ; i < N ; ++i )
- {
- T t(i);
- s.push_back(t);
- v.push_back(t);
- l.push_back(t);
- }
- // copy ctor
- {
- static_vector<T, N> s1(s);
- BOOST_CHECK(s.size() == s1.size());
- test_compare_ranges(s.begin(), s.end(), s1.begin(), s1.end());
- }
- // copy assignment
- {
- static_vector<T, N> s1;
- BOOST_CHECK(0 == s1.size());
- s1 = s;
- BOOST_CHECK(s.size() == s1.size());
- test_compare_ranges(s.begin(), s.end(), s1.begin(), s1.end());
- }
-
- // ctor(Iter, Iter) and assign(Iter, Iter)
- test_copy_and_assign<T, N>(s);
- test_copy_and_assign<T, N>(v);
- test_copy_and_assign<T, N>(l);
-
- // assign(N, V)
- {
- static_vector<T, N> s1(s);
- test_compare_ranges(s.begin(), s.end(), s1.begin(), s1.end());
- std::vector<T> a(N, val);
- s1.assign(N, val);
- test_compare_ranges(a.begin(), a.end(), s1.begin(), s1.end());
- }
-
-#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
- stable_vector<T> bsv(s.begin(), s.end());
- vector<T> bv(s.begin(), s.end());
- test_copy_and_assign<T, N>(bsv);
- test_copy_and_assign<T, N>(bv);
-#endif
-}
-
-template <typename T, size_t N>
-void test_iterators_nd()
-{
- static_vector<T, N> s;
- std::vector<T> v;
-
- for ( size_t i = 0 ; i < N ; ++i )
- {
- s.push_back(T(i));
- v.push_back(T(i));
- }
-
- test_compare_ranges(s.begin(), s.end(), v.begin(), v.end());
- test_compare_ranges(s.rbegin(), s.rend(), v.rbegin(), v.rend());
-
- s.assign(v.rbegin(), v.rend());
-
- test_compare_ranges(s.begin(), s.end(), v.rbegin(), v.rend());
- test_compare_ranges(s.rbegin(), s.rend(), v.begin(), v.end());
-}
-
-template <typename T, size_t N>
-void test_erase_nd()
-{
- static_vector<T, N> s;
- typedef typename static_vector<T, N>::iterator It;
-
- for ( size_t i = 0 ; i < N ; ++i )
- s.push_back(T(i));
-
- // erase(pos)
- {
- for ( size_t i = 0 ; i < N ; ++i )
- {
- static_vector<T, N> s1(s);
- It it = s1.erase(s1.begin() + i);
- BOOST_CHECK(s1.begin() + i == it);
- BOOST_CHECK(s1.size() == N - 1);
- for ( size_t j = 0 ; j < i ; ++j )
- BOOST_CHECK(s1[j] == T(j));
- for ( size_t j = i+1 ; j < N ; ++j )
- BOOST_CHECK(s1[j-1] == T(j));
- }
- }
- // erase(first, last)
- {
- size_t n = N/3;
- for ( size_t i = 0 ; i <= N ; ++i )
- {
- static_vector<T, N> s1(s);
- size_t removed = i + n < N ? n : N - i;
- It it = s1.erase(s1.begin() + i, s1.begin() + i + removed);
- BOOST_CHECK(s1.begin() + i == it);
- BOOST_CHECK(s1.size() == N - removed);
- for ( size_t j = 0 ; j < i ; ++j )
- BOOST_CHECK(s1[j] == T(j));
- for ( size_t j = i+n ; j < N ; ++j )
- BOOST_CHECK(s1[j-n] == T(j));
- }
- }
-}
-
-template <typename T, size_t N, typename SV, typename C>
-void test_insert(SV const& s, C const& c)
-{
- size_t h = N/2;
- size_t n = size_t(h/1.5f);
-
- for ( size_t i = 0 ; i <= h ; ++i )
- {
- static_vector<T, N> s1(s);
-
- typename C::const_iterator it = c.begin();
- std::advance(it, n);
- typename static_vector<T, N>::iterator
- it1 = s1.insert(s1.begin() + i, c.begin(), it);
-
- BOOST_CHECK(s1.begin() + i == it1);
- BOOST_CHECK(s1.size() == h+n);
- for ( size_t j = 0 ; j < i ; ++j )
- BOOST_CHECK(s1[j] == T(j));
- for ( size_t j = 0 ; j < n ; ++j )
- BOOST_CHECK(s1[j+i] == T(100 + j));
- for ( size_t j = 0 ; j < h-i ; ++j )
- BOOST_CHECK(s1[j+i+n] == T(j+i));
- }
-}
-
-template <typename T, size_t N>
-void test_insert_nd(T const& val)
-{
- size_t h = N/2;
-
- static_vector<T, N> s, ss;
- std::vector<T> v;
- std::list<T> l;
-
- typedef typename static_vector<T, N>::iterator It;
-
- for ( size_t i = 0 ; i < h ; ++i )
- {
- s.push_back(T(i));
- ss.push_back(T(100 + i));
- v.push_back(T(100 + i));
- l.push_back(T(100 + i));
- }
-
- // insert(pos, val)
- {
- for ( size_t i = 0 ; i <= h ; ++i )
- {
- static_vector<T, N> s1(s);
- It it = s1.insert(s1.begin() + i, val);
- BOOST_CHECK(s1.begin() + i == it);
- BOOST_CHECK(s1.size() == h+1);
- for ( size_t j = 0 ; j < i ; ++j )
- BOOST_CHECK(s1[j] == T(j));
- BOOST_CHECK(s1[i] == val);
- for ( size_t j = 0 ; j < h-i ; ++j )
- BOOST_CHECK(s1[j+i+1] == T(j+i));
- }
- }
- // insert(pos, n, val)
- {
- size_t n = size_t(h/1.5f);
- for ( size_t i = 0 ; i <= h ; ++i )
- {
- static_vector<T, N> s1(s);
- It it = s1.insert(s1.begin() + i, n, val);
- BOOST_CHECK(s1.begin() + i == it);
- BOOST_CHECK(s1.size() == h+n);
- for ( size_t j = 0 ; j < i ; ++j )
- BOOST_CHECK(s1[j] == T(j));
- for ( size_t j = 0 ; j < n ; ++j )
- BOOST_CHECK(s1[j+i] == val);
- for ( size_t j = 0 ; j < h-i ; ++j )
- BOOST_CHECK(s1[j+i+n] == T(j+i));
- }
- }
- // insert(pos, first, last)
- test_insert<T, N>(s, ss);
- test_insert<T, N>(s, v);
- test_insert<T, N>(s, l);
-
-#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
- stable_vector<T> bsv(ss.begin(), ss.end());
- vector<T> bv(ss.begin(), ss.end());
- test_insert<T, N>(s, bv);
- test_insert<T, N>(s, bsv);
-#endif
-}
-
-template <typename T>
-void test_capacity_0_nd()
-{
- static_vector<T, 10> v(5u, T(0));
-
- static_vector<T, 0, bad_alloc_strategy<T> > s;
- BOOST_CHECK(s.size() == 0);
- BOOST_CHECK(s.capacity() == 0);
-#ifndef BOOST_NO_EXCEPTIONS
- BOOST_CHECK_THROW(s.at(0), std::out_of_range);
- BOOST_CHECK_THROW(s.resize(5u, T(0)), std::bad_alloc);
- BOOST_CHECK_THROW(s.push_back(T(0)), std::bad_alloc);
- BOOST_CHECK_THROW(s.insert(s.end(), T(0)), std::bad_alloc);
- BOOST_CHECK_THROW(s.insert(s.end(), 5u, T(0)), std::bad_alloc);
- BOOST_CHECK_THROW(s.insert(s.end(), v.begin(), v.end()), std::bad_alloc);
- BOOST_CHECK_THROW(s.assign(v.begin(), v.end()), std::bad_alloc);
- BOOST_CHECK_THROW(s.assign(5u, T(0)), std::bad_alloc);
- try{
- static_vector<T, 0, bad_alloc_strategy<T> > s2(v.begin(), v.end());
- BOOST_CHECK(false);
- }catch(std::bad_alloc &){}
- try{
- static_vector<T, 0, bad_alloc_strategy<T> > s1(5u, T(0));
- BOOST_CHECK(false);
- }catch(std::bad_alloc &){}
-#endif // BOOST_NO_EXCEPTIONS
-}
-
-template <typename T, size_t N>
-void test_exceptions_nd()
-{
- static_vector<T, N> v(N, T(0));
- static_vector<T, N/2, bad_alloc_strategy<T> > s(N/2, T(0));
-
-#ifndef BOOST_NO_EXCEPTIONS
- BOOST_CHECK_THROW(s.resize(N, T(0)), std::bad_alloc);
- BOOST_CHECK_THROW(s.push_back(T(0)), std::bad_alloc);
- BOOST_CHECK_THROW(s.insert(s.end(), T(0)), std::bad_alloc);
- BOOST_CHECK_THROW(s.insert(s.end(), N, T(0)), std::bad_alloc);
- BOOST_CHECK_THROW(s.insert(s.end(), v.begin(), v.end()), std::bad_alloc);
- BOOST_CHECK_THROW(s.assign(v.begin(), v.end()), std::bad_alloc);
- BOOST_CHECK_THROW(s.assign(N, T(0)), std::bad_alloc);
- try{
- static_vector<T, N/2, bad_alloc_strategy<T> > s2(v.begin(), v.end());
- BOOST_CHECK(false);
- }catch(std::bad_alloc &){}
- try{
- static_vector<T, N/2, bad_alloc_strategy<T> > s1(N, T(0));
- BOOST_CHECK(false);
- }catch(std::bad_alloc &){}
-#endif // BOOST_NO_EXCEPTIONS
-}
-
-template <typename T, size_t N>
-void test_swap_and_move_nd()
-{
- {
- static_vector<T, N> v1, v2, v3, v4;
- static_vector<T, N> s1, s2;
- static_vector<T, N, bad_alloc_strategy<T> > s4;
-
- for (size_t i = 0 ; i < N ; ++i )
- {
- v1.push_back(T(i));
- v2.push_back(T(i));
- v3.push_back(T(i));
- v4.push_back(T(i));
- }
- for (size_t i = 0 ; i < N/2 ; ++i )
- {
- s1.push_back(T(100 + i));
- s2.push_back(T(100 + i));
- s4.push_back(T(100 + i));
- }
-
- s1.swap(v1);
- s2 = boost::move(v2);
- static_vector<T, N> s3(boost::move(v3));
- s4.swap(v4);
-
- BOOST_CHECK(v1.size() == N/2);
- BOOST_CHECK(s1.size() == N);
- BOOST_CHECK(v2.size() == 0);
- BOOST_CHECK(s2.size() == N);
- BOOST_CHECK(v3.size() == 0);
- BOOST_CHECK(s3.size() == N);
- BOOST_CHECK(v4.size() == N/2);
- BOOST_CHECK(s4.size() == N);
- for (size_t i = 0 ; i < N/2 ; ++i )
- {
- BOOST_CHECK(v1[i] == T(100 + i));
- BOOST_CHECK(v4[i] == T(100 + i));
- }
- for (size_t i = 0 ; i < N ; ++i )
- {
- BOOST_CHECK(s1[i] == T(i));
- BOOST_CHECK(s2[i] == T(i));
- BOOST_CHECK(s3[i] == T(i));
- BOOST_CHECK(s4[i] == T(i));
- }
- }
- {
- static_vector<T, N> v1, v2, v3;
- static_vector<T, N/2> s1, s2;
-
- for (size_t i = 0 ; i < N/2 ; ++i )
- {
- v1.push_back(T(i));
- v2.push_back(T(i));
- v3.push_back(T(i));
- }
- for (size_t i = 0 ; i < N/3 ; ++i )
- {
- s1.push_back(T(100 + i));
- s2.push_back(T(100 + i));
- }
-
- s1.swap(v1);
- s2 = boost::move(v2);
- static_vector<T, N/2> s3(boost::move(v3));
-
- BOOST_CHECK(v1.size() == N/3);
- BOOST_CHECK(s1.size() == N/2);
- BOOST_CHECK(v2.size() == 0);
- BOOST_CHECK(s2.size() == N/2);
- BOOST_CHECK(v3.size() == 0);
- BOOST_CHECK(s3.size() == N/2);
- for (size_t i = 0 ; i < N/3 ; ++i )
- BOOST_CHECK(v1[i] == T(100 + i));
- for (size_t i = 0 ; i < N/2 ; ++i )
- {
- BOOST_CHECK(s1[i] == T(i));
- BOOST_CHECK(s2[i] == T(i));
- BOOST_CHECK(s3[i] == T(i));
- }
- }
- {
- static_vector<T, N> v(N, T(0));
- static_vector<T, N/2, bad_alloc_strategy<T> > s(N/2, T(1));
-#ifndef BOOST_NO_EXCEPTIONS
- BOOST_CHECK_THROW(s.swap(v), std::bad_alloc);
- v.resize(N, T(0));
- BOOST_CHECK_THROW(s = boost::move(v), std::bad_alloc);
- v.resize(N, T(0));
- try {
- static_vector<T, N/2, bad_alloc_strategy<T> > s2(boost::move(v));
- BOOST_CHECK(false);
- } catch (std::bad_alloc &) {}
-#endif // BOOST_NO_EXCEPTIONS
- }
-}
-
-template <typename T, size_t N>
-void test_emplace_2p()
-{
- //emplace_back(pos, int, int)
- {
- static_vector<T, N, bad_alloc_strategy<T> > v;
-
- for (int i = 0 ; i < int(N) ; ++i )
- v.emplace_back(i, 100 + i);
- BOOST_CHECK(v.size() == N);
-#ifndef BOOST_NO_EXCEPTIONS
- BOOST_CHECK_THROW(v.emplace_back(N, 100 + N), std::bad_alloc);
-#endif
- BOOST_CHECK(v.size() == N);
- for (int i = 0 ; i < int(N) ; ++i )
- BOOST_CHECK(v[i] == T(i, 100 + i));
- }
-
- // emplace(pos, int, int)
- {
- typedef typename static_vector<T, N, bad_alloc_strategy<T> >::iterator It;
-
- int h = N / 2;
-
- static_vector<T, N, bad_alloc_strategy<T> > v;
- for ( int i = 0 ; i < h ; ++i )
- v.emplace_back(i, 100 + i);
-
- for ( int i = 0 ; i <= h ; ++i )
- {
- static_vector<T, N> vv(v);
- It it = vv.emplace(vv.begin() + i, i+100, i+200);
- BOOST_CHECK(vv.begin() + i == it);
- BOOST_CHECK(vv.size() == size_t(h+1));
- for ( int j = 0 ; j < i ; ++j )
- BOOST_CHECK(vv[j] == T(j, j+100));
- BOOST_CHECK(vv[i] == T(i+100, i+200));
- for ( int j = 0 ; j < h-i ; ++j )
- BOOST_CHECK(vv[j+i+1] == T(j+i, j+i+100));
- }
- }
-}
-
-template <typename T, size_t N>
-void test_sv_elem(T const& t)
-{
- typedef static_vector<T, N, bad_alloc_strategy<T> > V;
-
- static_vector<V, N, bad_alloc_strategy<V> > v;
-
- v.push_back(V(N/2, t));
- V vvv(N/2, t);
- v.push_back(boost::move(vvv));
- v.insert(v.begin(), V(N/2, t));
- v.insert(v.end(), V(N/2, t));
- v.emplace_back(N/2, t);
-}
-
-#ifdef BOOST_SINGLE_HEADER_UTF
-BOOST_AUTO_TEST_CASE(static_vector_test)
-#else // BOOST_SINGLE_HEADER_UTF
-int test_main(int, char* [])
-#endif // BOOST_SINGLE_HEADER_UTF
-{
- BOOST_CHECK(counting_value::count() == 0);
-
- test_ctor_ndc<int, 10>();
- test_ctor_ndc<value_ndc, 10>();
- test_ctor_ndc<counting_value, 10>();
- BOOST_CHECK(counting_value::count() == 0);
- test_ctor_ndc<shptr_value, 10>();
- test_ctor_ndc<copy_movable, 10>();
-
- test_ctor_nc<int, 10>(5);
- test_ctor_nc<value_nc, 10>(5);
- test_ctor_nc<counting_value, 10>(5);
- BOOST_CHECK(counting_value::count() == 0);
- test_ctor_nc<shptr_value, 10>(5);
- test_ctor_nc<copy_movable, 10>(5);
-
- test_ctor_nd<int, 10>(5, 1);
- test_ctor_nd<value_nd, 10>(5, value_nd(1));
- test_ctor_nd<counting_value, 10>(5, counting_value(1));
- BOOST_CHECK(counting_value::count() == 0);
- test_ctor_nd<shptr_value, 10>(5, shptr_value(1));
- test_ctor_nd<copy_movable, 10>(5, produce());
-
- test_resize_nc<int, 10>(5);
- test_resize_nc<value_nc, 10>(5);
- test_resize_nc<counting_value, 10>(5);
- BOOST_CHECK(counting_value::count() == 0);
- test_resize_nc<shptr_value, 10>(5);
- test_resize_nc<copy_movable, 10>(5);
-
- test_resize_nd<int, 10>(5, 1);
- test_resize_nd<value_nd, 10>(5, value_nd(1));
- test_resize_nd<counting_value, 10>(5, counting_value(1));
- BOOST_CHECK(counting_value::count() == 0);
- test_resize_nd<shptr_value, 10>(5, shptr_value(1));
- test_resize_nd<copy_movable, 10>(5, produce());
-
- test_push_back_nd<int, 10>();
- test_push_back_nd<value_nd, 10>();
- test_push_back_nd<counting_value, 10>();
- BOOST_CHECK(counting_value::count() == 0);
- test_push_back_nd<shptr_value, 10>();
- test_push_back_nd<copy_movable, 10>();
-
- test_pop_back_nd<int, 10>();
- test_pop_back_nd<value_nd, 10>();
- test_pop_back_nd<counting_value, 10>();
- BOOST_CHECK(counting_value::count() == 0);
- test_pop_back_nd<shptr_value, 10>();
- test_pop_back_nd<copy_movable, 10>();
-
- test_copy_and_assign_nd<int, 10>(1);
- test_copy_and_assign_nd<value_nd, 10>(value_nd(1));
- test_copy_and_assign_nd<counting_value, 10>(counting_value(1));
- BOOST_CHECK(counting_value::count() == 0);
- test_copy_and_assign_nd<shptr_value, 10>(shptr_value(1));
- test_copy_and_assign_nd<copy_movable, 10>(produce());
-
- test_iterators_nd<int, 10>();
- test_iterators_nd<value_nd, 10>();
- test_iterators_nd<counting_value, 10>();
- BOOST_CHECK(counting_value::count() == 0);
- test_iterators_nd<shptr_value, 10>();
- test_iterators_nd<copy_movable, 10>();
-
- test_erase_nd<int, 10>();
- test_erase_nd<value_nd, 10>();
- test_erase_nd<counting_value, 10>();
- BOOST_CHECK(counting_value::count() == 0);
- test_erase_nd<shptr_value, 10>();
- test_erase_nd<copy_movable, 10>();
-
- test_insert_nd<int, 10>(50);
- test_insert_nd<value_nd, 10>(value_nd(50));
- test_insert_nd<counting_value, 10>(counting_value(50));
- BOOST_CHECK(counting_value::count() == 0);
- test_insert_nd<shptr_value, 10>(shptr_value(50));
- test_insert_nd<copy_movable, 10>(produce());
-
- test_capacity_0_nd<int>();
- test_capacity_0_nd<value_nd>();
- test_capacity_0_nd<counting_value>();
- BOOST_CHECK(counting_value::count() == 0);
- test_capacity_0_nd<shptr_value>();
- test_capacity_0_nd<copy_movable>();
-
- test_exceptions_nd<int, 10>();
- test_exceptions_nd<value_nd, 10>();
- test_exceptions_nd<counting_value, 10>();
- BOOST_CHECK(counting_value::count() == 0);
- test_exceptions_nd<shptr_value, 10>();
- test_exceptions_nd<copy_movable, 10>();
-
- test_swap_and_move_nd<int, 10>();
- test_swap_and_move_nd<value_nd, 10>();
- test_swap_and_move_nd<counting_value, 10>();
- BOOST_CHECK(counting_value::count() == 0);
- test_swap_and_move_nd<shptr_value, 10>();
- test_swap_and_move_nd<copy_movable, 10>();
-
- test_emplace_2p<counting_value, 10>();
- BOOST_CHECK(counting_value::count() == 0);
-
- test_sv_elem<int, 10>(50);
- test_sv_elem<value_nd, 10>(value_nd(50));
- test_sv_elem<counting_value, 10>(counting_value(50));
- BOOST_CHECK(counting_value::count() == 0);
- test_sv_elem<shptr_value, 10>(shptr_value(50));
- test_sv_elem<copy_movable, 10>(copy_movable(50));
-
-#ifndef BOOST_SINGLE_HEADER_UTF
- return 0;
-#endif // BOOST_SINGLE_HEADER_UTF
-}

Deleted: sandbox/varray/test/static_vector_test.hpp
==============================================================================
--- sandbox/varray/test/static_vector_test.hpp 2013-01-26 22:36:10 EST (Sat, 26 Jan 2013)
+++ (empty file)
@@ -1,99 +0,0 @@
-// Boost.Container StaticVector
-// Unit Test
-
-// Copyright (c) 2012 Adam Wulkiewicz, Lodz, Poland.
-// Copyright (c) 2012 Andrew Hundt.
-
-// 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)
-
-#ifndef BOOST_CONTAINER_TEST_STATIC_VECTOR_TEST_HPP
-#define BOOST_CONTAINER_TEST_STATIC_VECTOR_TEST_HPP
-
-#include <boost/container/static_vector.hpp>
-
-#include <boost/shared_ptr.hpp>
-#include "movable.hpp"
-
-using namespace boost::container;
-
-class value_ndc
-{
-public:
- explicit value_ndc(int a) : aa(a) {}
- ~value_ndc() {}
- bool operator==(value_ndc const& v) const { return aa == v.aa; }
- bool operator<(value_ndc const& v) const { return aa < v.aa; }
-private:
- value_ndc(value_ndc const&) {}
- value_ndc & operator=(value_ndc const&) { return *this; }
- int aa;
-};
-
-class value_nd
-{
-public:
- explicit value_nd(int a) : aa(a) {}
- ~value_nd() {}
- bool operator==(value_nd const& v) const { return aa == v.aa; }
- bool operator<(value_nd const& v) const { return aa < v.aa; }
-private:
- int aa;
-};
-
-class value_nc
-{
-public:
- explicit value_nc(int a = 0) : aa(a) {}
- ~value_nc() {}
- bool operator==(value_nc const& v) const { return aa == v.aa; }
- bool operator<(value_nc const& v) const { return aa < v.aa; }
-private:
- value_nc(value_nc const&) {}
- value_nc & operator=(value_ndc const&) { return *this; }
- int aa;
-};
-
-class counting_value
-{
- BOOST_COPYABLE_AND_MOVABLE(counting_value)
-
-public:
- explicit counting_value(int a = 0, int b = 0) : aa(a), bb(b) { ++c(); }
- counting_value(counting_value const& v) : aa(v.aa), bb(v.bb) { ++c(); }
- counting_value(BOOST_RV_REF(counting_value) p) : aa(p.aa), bb(p.bb) { p.aa = 0; p.bb = 0; ++c(); } // Move constructor
- counting_value& operator=(BOOST_RV_REF(counting_value) p) { aa = p.aa; p.aa = 0; bb = p.bb; p.bb = 0; return *this; } // Move assignment
- counting_value& operator=(BOOST_COPY_ASSIGN_REF(counting_value) p) { aa = p.aa; bb = p.bb; return *this; } // Copy assignment
- ~counting_value() { --c(); }
- bool operator==(counting_value const& v) const { return aa == v.aa && bb == v.bb; }
- bool operator<(counting_value const& v) const { return aa < v.aa || ( aa == v.aa && bb < v.bb ); }
- static size_t count() { return c(); }
-
-private:
- static size_t & c() { static size_t co = 0; return co; }
- int aa, bb;
-};
-
-namespace boost {
-
-template <>
-struct has_nothrow_move<counting_value>
-{
- static const bool value = true;
-};
-
-}
-
-class shptr_value
-{
- typedef boost::shared_ptr<int> Ptr;
-public:
- explicit shptr_value(int a = 0) : m_ptr(new int(a)) {}
- bool operator==(shptr_value const& v) const { return *m_ptr == *(v.m_ptr); }
- bool operator<(shptr_value const& v) const { return *m_ptr < *(v.m_ptr); }
-private:
- boost::shared_ptr<int> m_ptr;
-};
-
-#endif // BOOST_CONTAINER_TEST_STATIC_VECTOR_TEST_HPP

Copied: sandbox/varray/test/varray_interprocess_test.cpp (from r82619, /sandbox/varray/test/static_vector_interprocess_test.cpp)
==============================================================================
--- /sandbox/varray/test/static_vector_interprocess_test.cpp (original)
+++ sandbox/varray/test/varray_interprocess_test.cpp 2013-01-26 22:36:10 EST (Sat, 26 Jan 2013)
@@ -1,8 +1,8 @@
-// Boost.Container StaticVector
+// Boost.Container varray
 // Unit Test
 
-// Copyright (c) 2012 Adam Wulkiewicz, Lodz, Poland.
-// Copyright (c) 2012 Andrew Hundt.
+// Copyright (c) 2012-2013 Adam Wulkiewicz, Lodz, Poland.
+// Copyright (c) 2012-2013 Andrew Hundt.
 
 // Use, modification and distribution is subject to the Boost Software License,
 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -16,7 +16,7 @@
 #include <boost/test/impl/execution_monitor.ipp>
 #endif // BOOST_SINGLE_HEADER_UTF
 
-#include "static_vector_test.hpp"
+#include "varray_test.hpp"
 
 #include <boost/interprocess/managed_shared_memory.hpp>
 #include <boost/interprocess/allocators/allocator.hpp>
@@ -24,7 +24,7 @@
 
 template <typename V, typename SegmentManager>
 struct interprocess_strategy
- : public strategy::allocator_adaptor<
+ : public container_detail::strategy::allocator_adaptor<
         boost::interprocess::allocator<V, SegmentManager>
>
 {};
@@ -41,7 +41,7 @@
 
     bi::managed_shared_memory shmem(bi::create_only, "shared_memory", 10000 + sizeof(T) * N);
 
- typedef static_vector<
+ typedef container_detail::varray<
         T, N,
         interprocess_strategy<T, bi::managed_shared_memory::segment_manager>
> SV;

Copied: sandbox/varray/test/varray_test.cpp (from r82619, /sandbox/varray/test/static_vector_test.cpp)
==============================================================================
--- /sandbox/varray/test/static_vector_test.cpp (original)
+++ sandbox/varray/test/varray_test.cpp 2013-01-26 22:36:10 EST (Sat, 26 Jan 2013)
@@ -1,15 +1,15 @@
-// Boost.Container StaticVector
+// Boost.Container varray
 // Unit Test
 
-// Copyright (c) 2012 Adam Wulkiewicz, Lodz, Poland.
-// Copyright (c) 2012 Andrew Hundt.
+// Copyright (c) 2012-2013 Adam Wulkiewicz, Lodz, Poland.
+// Copyright (c) 2012-2013 Andrew Hundt.
 
 // 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)
 
 #ifdef BOOST_SINGLE_HEADER_UTF
-#define BOOST_TEST_MODULE static_vector_tests
+#define BOOST_TEST_MODULE varray_tests
 #include <boost/test/unit_test.hpp>
 #else // BOOST_SINGLE_HEADER_UTF
 #include <boost/test/included/test_exec_monitor.hpp>
@@ -32,11 +32,11 @@
 #include <boost/container/stable_vector.hpp>
 #endif
 
-#include "static_vector_test.hpp"
+#include "varray_test.hpp"
 
 template <typename V>
 struct bad_alloc_strategy
- : public strategy::def<V>
+ : public container_detail::strategy::def<V>
 {
     static void allocate_failed()
     {
@@ -47,7 +47,7 @@
 template <typename T, size_t N>
 void test_ctor_ndc()
 {
- static_vector<T, N> s;
+ varray<T, N> s;
     BOOST_CHECK_EQUAL(s.size() , 0);
     BOOST_CHECK(s.capacity() == N);
 #ifndef BOOST_NO_EXCEPTIONS
@@ -58,7 +58,7 @@
 template <typename T, size_t N>
 void test_ctor_nc(size_t n)
 {
- static_vector<T, N> s(n);
+ varray<T, N> s(n);
     BOOST_CHECK(s.size() == n);
     BOOST_CHECK(s.capacity() == N);
 #ifndef BOOST_NO_EXCEPTIONS
@@ -80,7 +80,7 @@
 template <typename T, size_t N>
 void test_ctor_nd(size_t n, T const& v)
 {
- static_vector<T, N> s(n, v);
+ varray<T, N> s(n, v);
     BOOST_CHECK(s.size() == n);
     BOOST_CHECK(s.capacity() == N);
 #ifndef BOOST_NO_EXCEPTIONS
@@ -104,7 +104,7 @@
 template <typename T, size_t N>
 void test_resize_nc(size_t n)
 {
- static_vector<T, N> s;
+ varray<T, N> s;
 
     s.resize(n);
     BOOST_CHECK(s.size() == n);
@@ -128,7 +128,7 @@
 template <typename T, size_t N>
 void test_resize_nd(size_t n, T const& v)
 {
- static_vector<T, N> s;
+ varray<T, N> s;
 
     s.resize(n, v);
     BOOST_CHECK(s.size() == n);
@@ -154,7 +154,7 @@
 template <typename T, size_t N>
 void test_push_back_nd()
 {
- static_vector<T, N> s;
+ varray<T, N> s;
 
     BOOST_CHECK(s.size() == 0);
 #ifndef BOOST_NO_EXCEPTIONS
@@ -180,7 +180,7 @@
 template <typename T, size_t N>
 void test_pop_back_nd()
 {
- static_vector<T, N> s;
+ varray<T, N> s;
 
     for ( size_t i = 0 ; i < N ; ++i )
     {
@@ -214,12 +214,12 @@
 void test_copy_and_assign(C const& c)
 {
     {
- static_vector<T, N> s(c.begin(), c.end());
+ varray<T, N> s(c.begin(), c.end());
         BOOST_CHECK(s.size() == c.size());
         test_compare_ranges(s.begin(), s.end(), c.begin(), c.end());
     }
     {
- static_vector<T, N> s;
+ varray<T, N> s;
         BOOST_CHECK(0 == s.size());
         s.assign(c.begin(), c.end());
         BOOST_CHECK(s.size() == c.size());
@@ -230,7 +230,7 @@
 template <typename T, size_t N>
 void test_copy_and_assign_nd(T const& val)
 {
- static_vector<T, N> s;
+ varray<T, N> s;
     std::vector<T> v;
     std::list<T> l;
 
@@ -243,13 +243,13 @@
     }
     // copy ctor
     {
- static_vector<T, N> s1(s);
+ varray<T, N> s1(s);
         BOOST_CHECK(s.size() == s1.size());
         test_compare_ranges(s.begin(), s.end(), s1.begin(), s1.end());
     }
     // copy assignment
     {
- static_vector<T, N> s1;
+ varray<T, N> s1;
         BOOST_CHECK(0 == s1.size());
         s1 = s;
         BOOST_CHECK(s.size() == s1.size());
@@ -263,7 +263,7 @@
 
     // assign(N, V)
     {
- static_vector<T, N> s1(s);
+ varray<T, N> s1(s);
         test_compare_ranges(s.begin(), s.end(), s1.begin(), s1.end());
         std::vector<T> a(N, val);
         s1.assign(N, val);
@@ -281,7 +281,7 @@
 template <typename T, size_t N>
 void test_iterators_nd()
 {
- static_vector<T, N> s;
+ varray<T, N> s;
     std::vector<T> v;
 
     for ( size_t i = 0 ; i < N ; ++i )
@@ -302,8 +302,8 @@
 template <typename T, size_t N>
 void test_erase_nd()
 {
- static_vector<T, N> s;
- typedef typename static_vector<T, N>::iterator It;
+ varray<T, N> s;
+ typedef typename varray<T, N>::iterator It;
 
     for ( size_t i = 0 ; i < N ; ++i )
         s.push_back(T(i));
@@ -312,7 +312,7 @@
     {
         for ( size_t i = 0 ; i < N ; ++i )
         {
- static_vector<T, N> s1(s);
+ varray<T, N> s1(s);
             It it = s1.erase(s1.begin() + i);
             BOOST_CHECK(s1.begin() + i == it);
             BOOST_CHECK(s1.size() == N - 1);
@@ -327,7 +327,7 @@
         size_t n = N/3;
         for ( size_t i = 0 ; i <= N ; ++i )
         {
- static_vector<T, N> s1(s);
+ varray<T, N> s1(s);
             size_t removed = i + n < N ? n : N - i;
             It it = s1.erase(s1.begin() + i, s1.begin() + i + removed);
             BOOST_CHECK(s1.begin() + i == it);
@@ -348,11 +348,11 @@
 
     for ( size_t i = 0 ; i <= h ; ++i )
     {
- static_vector<T, N> s1(s);
+ varray<T, N> s1(s);
 
         typename C::const_iterator it = c.begin();
         std::advance(it, n);
- typename static_vector<T, N>::iterator
+ typename varray<T, N>::iterator
             it1 = s1.insert(s1.begin() + i, c.begin(), it);
 
         BOOST_CHECK(s1.begin() + i == it1);
@@ -371,11 +371,11 @@
 {
     size_t h = N/2;
 
- static_vector<T, N> s, ss;
+ varray<T, N> s, ss;
     std::vector<T> v;
     std::list<T> l;
 
- typedef typename static_vector<T, N>::iterator It;
+ typedef typename varray<T, N>::iterator It;
 
     for ( size_t i = 0 ; i < h ; ++i )
     {
@@ -389,7 +389,7 @@
     {
         for ( size_t i = 0 ; i <= h ; ++i )
         {
- static_vector<T, N> s1(s);
+ varray<T, N> s1(s);
             It it = s1.insert(s1.begin() + i, val);
             BOOST_CHECK(s1.begin() + i == it);
             BOOST_CHECK(s1.size() == h+1);
@@ -405,7 +405,7 @@
         size_t n = size_t(h/1.5f);
         for ( size_t i = 0 ; i <= h ; ++i )
         {
- static_vector<T, N> s1(s);
+ varray<T, N> s1(s);
             It it = s1.insert(s1.begin() + i, n, val);
             BOOST_CHECK(s1.begin() + i == it);
             BOOST_CHECK(s1.size() == h+n);
@@ -433,9 +433,9 @@
 template <typename T>
 void test_capacity_0_nd()
 {
- static_vector<T, 10> v(5u, T(0));
+ varray<T, 10> v(5u, T(0));
 
- static_vector<T, 0, bad_alloc_strategy<T> > s;
+ container_detail::varray<T, 0, bad_alloc_strategy<T> > s;
     BOOST_CHECK(s.size() == 0);
     BOOST_CHECK(s.capacity() == 0);
 #ifndef BOOST_NO_EXCEPTIONS
@@ -448,11 +448,11 @@
     BOOST_CHECK_THROW(s.assign(v.begin(), v.end()), std::bad_alloc);
     BOOST_CHECK_THROW(s.assign(5u, T(0)), std::bad_alloc);
     try{
- static_vector<T, 0, bad_alloc_strategy<T> > s2(v.begin(), v.end());
+ container_detail::varray<T, 0, bad_alloc_strategy<T> > s2(v.begin(), v.end());
         BOOST_CHECK(false);
     }catch(std::bad_alloc &){}
     try{
- static_vector<T, 0, bad_alloc_strategy<T> > s1(5u, T(0));
+ container_detail::varray<T, 0, bad_alloc_strategy<T> > s1(5u, T(0));
         BOOST_CHECK(false);
     }catch(std::bad_alloc &){}
 #endif // BOOST_NO_EXCEPTIONS
@@ -461,8 +461,8 @@
 template <typename T, size_t N>
 void test_exceptions_nd()
 {
- static_vector<T, N> v(N, T(0));
- static_vector<T, N/2, bad_alloc_strategy<T> > s(N/2, T(0));
+ varray<T, N> v(N, T(0));
+ container_detail::varray<T, N/2, bad_alloc_strategy<T> > s(N/2, T(0));
 
 #ifndef BOOST_NO_EXCEPTIONS
     BOOST_CHECK_THROW(s.resize(N, T(0)), std::bad_alloc);
@@ -473,11 +473,11 @@
     BOOST_CHECK_THROW(s.assign(v.begin(), v.end()), std::bad_alloc);
     BOOST_CHECK_THROW(s.assign(N, T(0)), std::bad_alloc);
     try{
- static_vector<T, N/2, bad_alloc_strategy<T> > s2(v.begin(), v.end());
+ container_detail::varray<T, N/2, bad_alloc_strategy<T> > s2(v.begin(), v.end());
         BOOST_CHECK(false);
     }catch(std::bad_alloc &){}
     try{
- static_vector<T, N/2, bad_alloc_strategy<T> > s1(N, T(0));
+ container_detail::varray<T, N/2, bad_alloc_strategy<T> > s1(N, T(0));
         BOOST_CHECK(false);
     }catch(std::bad_alloc &){}
 #endif // BOOST_NO_EXCEPTIONS
@@ -487,9 +487,9 @@
 void test_swap_and_move_nd()
 {
     {
- static_vector<T, N> v1, v2, v3, v4;
- static_vector<T, N> s1, s2;
- static_vector<T, N, bad_alloc_strategy<T> > s4;
+ varray<T, N> v1, v2, v3, v4;
+ varray<T, N> s1, s2;
+ container_detail::varray<T, N, bad_alloc_strategy<T> > s4;
 
         for (size_t i = 0 ; i < N ; ++i )
         {
@@ -507,7 +507,7 @@
 
         s1.swap(v1);
         s2 = boost::move(v2);
- static_vector<T, N> s3(boost::move(v3));
+ varray<T, N> s3(boost::move(v3));
         s4.swap(v4);
 
         BOOST_CHECK(v1.size() == N/2);
@@ -532,8 +532,8 @@
         }
     }
     {
- static_vector<T, N> v1, v2, v3;
- static_vector<T, N/2> s1, s2;
+ varray<T, N> v1, v2, v3;
+ varray<T, N/2> s1, s2;
 
         for (size_t i = 0 ; i < N/2 ; ++i )
         {
@@ -549,7 +549,7 @@
 
         s1.swap(v1);
         s2 = boost::move(v2);
- static_vector<T, N/2> s3(boost::move(v3));
+ varray<T, N/2> s3(boost::move(v3));
 
         BOOST_CHECK(v1.size() == N/3);
         BOOST_CHECK(s1.size() == N/2);
@@ -567,15 +567,15 @@
         }
     }
     {
- static_vector<T, N> v(N, T(0));
- static_vector<T, N/2, bad_alloc_strategy<T> > s(N/2, T(1));
+ varray<T, N> v(N, T(0));
+ container_detail::varray<T, N/2, bad_alloc_strategy<T> > s(N/2, T(1));
 #ifndef BOOST_NO_EXCEPTIONS
         BOOST_CHECK_THROW(s.swap(v), std::bad_alloc);
         v.resize(N, T(0));
         BOOST_CHECK_THROW(s = boost::move(v), std::bad_alloc);
         v.resize(N, T(0));
         try {
- static_vector<T, N/2, bad_alloc_strategy<T> > s2(boost::move(v));
+ container_detail::varray<T, N/2, bad_alloc_strategy<T> > s2(boost::move(v));
             BOOST_CHECK(false);
         } catch (std::bad_alloc &) {}
 #endif // BOOST_NO_EXCEPTIONS
@@ -587,7 +587,7 @@
 {
     //emplace_back(pos, int, int)
     {
- static_vector<T, N, bad_alloc_strategy<T> > v;
+ container_detail::varray<T, N, bad_alloc_strategy<T> > v;
 
         for (int i = 0 ; i < int(N) ; ++i )
             v.emplace_back(i, 100 + i);
@@ -602,17 +602,17 @@
 
     // emplace(pos, int, int)
     {
- typedef typename static_vector<T, N, bad_alloc_strategy<T> >::iterator It;
+ typedef typename container_detail::varray<T, N, bad_alloc_strategy<T> >::iterator It;
 
         int h = N / 2;
 
- static_vector<T, N, bad_alloc_strategy<T> > v;
+ container_detail::varray<T, N, bad_alloc_strategy<T> > v;
         for ( int i = 0 ; i < h ; ++i )
             v.emplace_back(i, 100 + i);
 
         for ( int i = 0 ; i <= h ; ++i )
         {
- static_vector<T, N> vv(v);
+ container_detail::varray<T, N, bad_alloc_strategy<T> > vv(v);
             It it = vv.emplace(vv.begin() + i, i+100, i+200);
             BOOST_CHECK(vv.begin() + i == it);
             BOOST_CHECK(vv.size() == size_t(h+1));
@@ -628,9 +628,9 @@
 template <typename T, size_t N>
 void test_sv_elem(T const& t)
 {
- typedef static_vector<T, N, bad_alloc_strategy<T> > V;
+ typedef container_detail::varray<T, N, bad_alloc_strategy<T> > V;
 
- static_vector<V, N, bad_alloc_strategy<V> > v;
+ container_detail::varray<V, N, bad_alloc_strategy<V> > v;
 
     v.push_back(V(N/2, t));
     V vvv(N/2, t);
@@ -641,7 +641,7 @@
 }
 
 #ifdef BOOST_SINGLE_HEADER_UTF
-BOOST_AUTO_TEST_CASE(static_vector_test)
+BOOST_AUTO_TEST_CASE(varray_test)
 #else // BOOST_SINGLE_HEADER_UTF
 int test_main(int, char* [])
 #endif // BOOST_SINGLE_HEADER_UTF

Copied: sandbox/varray/test/varray_test.hpp (from r82619, /sandbox/varray/test/static_vector_test.hpp)
==============================================================================
--- /sandbox/varray/test/static_vector_test.hpp (original)
+++ sandbox/varray/test/varray_test.hpp 2013-01-26 22:36:10 EST (Sat, 26 Jan 2013)
@@ -1,17 +1,17 @@
-// Boost.Container StaticVector
+// Boost.Container varray
 // Unit Test
 
-// Copyright (c) 2012 Adam Wulkiewicz, Lodz, Poland.
-// Copyright (c) 2012 Andrew Hundt.
+// Copyright (c) 2012-2013 Adam Wulkiewicz, Lodz, Poland.
+// Copyright (c) 2012-2013 Andrew Hundt.
 
 // 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)
 
-#ifndef BOOST_CONTAINER_TEST_STATIC_VECTOR_TEST_HPP
-#define BOOST_CONTAINER_TEST_STATIC_VECTOR_TEST_HPP
+#ifndef BOOST_CONTAINER_TEST_VARRAY_TEST_HPP
+#define BOOST_CONTAINER_TEST_VARRAY_TEST_HPP
 
-#include <boost/container/static_vector.hpp>
+#include <boost/container/varray.hpp>
 
 #include <boost/shared_ptr.hpp>
 #include "movable.hpp"
@@ -96,4 +96,4 @@
     boost::shared_ptr<int> m_ptr;
 };
 
-#endif // BOOST_CONTAINER_TEST_STATIC_VECTOR_TEST_HPP
+#endif // BOOST_CONTAINER_TEST_VARRAY_TEST_HPP


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk