File Coverage

/usr/local/lib/perl5/site_perl/5.26.1/XS/libboost/mini.x/i/boost/container/small_vector.hpp
Criterion Covered Total %
statement 0 21 0.0
branch 0 4 0.0
condition n/a
subroutine n/a
pod n/a
total 0 25 0.0


line stmt bran cond sub pod time code
1             //////////////////////////////////////////////////////////////////////////////
2             //
3             // (C) Copyright Ion Gaztanaga 2015-2015. Distributed under the Boost
4             // Software License, Version 1.0. (See accompanying file
5             // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6             //
7             // See http://www.boost.org/libs/container for documentation.
8             //
9             //////////////////////////////////////////////////////////////////////////////
10              
11             #ifndef BOOST_CONTAINER_CONTAINER_SMALL_VECTOR_HPP
12             #define BOOST_CONTAINER_CONTAINER_SMALL_VECTOR_HPP
13              
14             #ifndef BOOST_CONFIG_HPP
15             # include
16             #endif
17              
18             #if defined(BOOST_HAS_PRAGMA_ONCE)
19             # pragma once
20             #endif
21              
22             #include
23             #include
24              
25             // container
26             #include
27             #include
28             #include
29             #include //new_allocator
30             // container/detail
31             #include
32             #include
33              
34             //move
35             #include
36             #include
37              
38             //move/detail
39             #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
40             #include
41             #endif
42              
43             //std
44             #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
45             #include //for std::initializer_list
46             #endif
47              
48             namespace boost {
49             namespace container {
50              
51             #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
52              
53             template >
54             class small_vector_base;
55              
56             #endif
57              
58             //! A non-standard allocator used to implement `small_vector`.
59             //! Users should never use it directly. It is described here
60             //! for documentation purposes.
61             //!
62             //! This allocator inherits from a standard-conforming allocator
63             //! and forwards member functions to the standard allocator except
64             //! when internal storage is being used as memory source.
65             //!
66             //! This allocator is a "partially_propagable" allocator and
67             //! defines `is_partially_propagable` as true_type.
68             //!
69             //! A partially propagable allocator means that not all storage
70             //! allocatod by an instance of `small_vector_allocator` can be
71             //! deallocated by another instance of this type, even if both
72             //! instances compare equal or an instance is propagated to another
73             //! one using the copy/move constructor or assignment. The storage that
74             //! can never be propagated is identified by `storage_is_unpropagable(p)`.
75             //!
76             //! `boost::container::vector` supports partially propagable allocators
77             //! fallbacking to deep copy/swap/move operations when internal storage
78             //! is being used to store vector elements.
79             //!
80             //! `small_vector_allocator` assumes that will be instantiated as
81             //! `boost::container::vector< T, small_vector_allocator >`
82             //! and internal storage can be obtained downcasting that vector
83             //! to `small_vector_base`.
84             template
85             class small_vector_allocator
86             : public Allocator
87             {
88             typedef unsigned int allocation_type;
89             #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
90             private:
91              
92             BOOST_COPYABLE_AND_MOVABLE(small_vector_allocator)
93              
94             BOOST_CONTAINER_FORCEINLINE const Allocator &as_base() const
95             { return static_cast(*this); }
96              
97             BOOST_CONTAINER_FORCEINLINE Allocator &as_base()
98 0           { return static_cast(*this); }
99              
100             #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
101              
102             public:
103             #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
104             typedef allocator_traits allocator_traits_type;
105             #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
106              
107             typedef typename allocator_traits::value_type value_type;
108             typedef typename allocator_traits::pointer pointer;
109             typedef typename allocator_traits::const_pointer const_pointer;
110             typedef typename allocator_traits::reference reference;
111             typedef typename allocator_traits::const_reference const_reference;
112             typedef typename allocator_traits::size_type size_type;
113             typedef typename allocator_traits::difference_type difference_type;
114             typedef typename allocator_traits::void_pointer void_pointer;
115             typedef typename allocator_traits::const_void_pointer const_void_pointer;
116              
117             typedef typename allocator_traits::propagate_on_container_copy_assignment propagate_on_container_copy_assignment;
118             typedef typename allocator_traits::propagate_on_container_move_assignment propagate_on_container_move_assignment;
119             typedef typename allocator_traits::propagate_on_container_swap propagate_on_container_swap;
120             //! An integral constant with member `value == false`
121             typedef BOOST_CONTAINER_IMPDEF(dtl::bool_) is_always_equal;
122             //! An integral constant with member `value == true`
123             typedef BOOST_CONTAINER_IMPDEF(dtl::bool_) is_partially_propagable;
124              
125             BOOST_CONTAINER_DOCIGN(typedef dtl::version_type version;)
126              
127             //!Obtains an small_vector_allocator that allocates
128             //!objects of type T2
129             template
130             struct rebind
131             {
132             typedef typename allocator_traits::template rebind_alloc::type other;
133             };
134              
135             #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
136             //!Constructor from arbitrary arguments
137             template
138             BOOST_CONTAINER_FORCEINLINE explicit small_vector_allocator(BOOST_FWD_REF(Args) ...args)
139 0           : Allocator(::boost::forward(args)...)
140             {}
141             #else
142             #define BOOST_CONTAINER_SMALL_VECTOR_ALLOCATOR_CTOR_CODE(N) \
143             BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
144             BOOST_CONTAINER_FORCEINLINE explicit small_vector_allocator(BOOST_MOVE_UREF##N)\
145             : Allocator(BOOST_MOVE_FWD##N)\
146             {}\
147             //
148             BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_SMALL_VECTOR_ALLOCATOR_CTOR_CODE)
149             #undef BOOST_CONTAINER_SMALL_VECTOR_ALLOCATOR_CTOR_CODE
150             #endif
151              
152             //!Constructor from other small_vector_allocator.
153             //!Never throws
154             BOOST_CONTAINER_FORCEINLINE small_vector_allocator
155             (const small_vector_allocator &other) BOOST_NOEXCEPT_OR_NOTHROW
156             : Allocator(other.as_base())
157             {}
158              
159             //!Move constructor from small_vector_allocator.
160             //!Never throws
161             BOOST_CONTAINER_FORCEINLINE small_vector_allocator
162             (BOOST_RV_REF(small_vector_allocator) other) BOOST_NOEXCEPT_OR_NOTHROW
163             : Allocator(::boost::move(other.as_base()))
164             {}
165              
166             //!Constructor from related small_vector_allocator.
167             //!Never throws
168             template
169             BOOST_CONTAINER_FORCEINLINE small_vector_allocator
170             (const small_vector_allocator &other) BOOST_NOEXCEPT_OR_NOTHROW
171             : Allocator(other.as_base())
172             {}
173              
174             //!Move constructor from related small_vector_allocator.
175             //!Never throws
176             template
177             BOOST_CONTAINER_FORCEINLINE small_vector_allocator
178             (BOOST_RV_REF(small_vector_allocator) other) BOOST_NOEXCEPT_OR_NOTHROW
179             : Allocator(::boost::move(other.as_base()))
180             {}
181              
182             //!Assignment from other small_vector_allocator.
183             //!Never throws
184             BOOST_CONTAINER_FORCEINLINE small_vector_allocator &
185             operator=(BOOST_COPY_ASSIGN_REF(small_vector_allocator) other) BOOST_NOEXCEPT_OR_NOTHROW
186             { return static_cast(this->Allocator::operator=(other.as_base())); }
187              
188             //!Move constructor from other small_vector_allocator.
189             //!Never throws
190             BOOST_CONTAINER_FORCEINLINE small_vector_allocator &
191             operator=(BOOST_RV_REF(small_vector_allocator) other) BOOST_NOEXCEPT_OR_NOTHROW
192             { return static_cast(this->Allocator::operator=(::boost::move(other.as_base()))); }
193              
194             //!Assignment from related small_vector_allocator.
195             //!Never throws
196             template
197             BOOST_CONTAINER_FORCEINLINE small_vector_allocator &
198             operator=(BOOST_COPY_ASSIGN_REF(small_vector_allocator) other) BOOST_NOEXCEPT_OR_NOTHROW
199             { return static_cast(this->Allocator::operator=(other.as_base())); }
200              
201             //!Move assignment from related small_vector_allocator.
202             //!Never throws
203             template
204             BOOST_CONTAINER_FORCEINLINE small_vector_allocator &
205             operator=(BOOST_RV_REF(small_vector_allocator) other) BOOST_NOEXCEPT_OR_NOTHROW
206             { return static_cast(this->Allocator::operator=(::boost::move(other.as_base()))); }
207              
208             //!Allocates storage from the standard-conforming allocator
209             BOOST_CONTAINER_FORCEINLINE pointer allocate(size_type count, const_void_pointer hint = const_void_pointer())
210             { return allocator_traits_type::allocate(this->as_base(), count, hint); }
211              
212             //!Deallocates previously allocated memory.
213             //!Never throws
214 0           void deallocate(pointer ptr, size_type n) BOOST_NOEXCEPT_OR_NOTHROW
215             {
216 0 0         if(!this->is_internal_storage(ptr))
    0          
217 0           allocator_traits_type::deallocate(this->as_base(), ptr, n);
218 0           }
219              
220             //!Returns the maximum number of elements that could be allocated.
221             //!Never throws
222             BOOST_CONTAINER_FORCEINLINE size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW
223             { return allocator_traits_type::max_size(this->as_base()); }
224              
225             small_vector_allocator select_on_container_copy_construction() const
226             { return small_vector_allocator(allocator_traits_type::select_on_container_copy_construction(this->as_base())); }
227              
228             bool storage_is_unpropagable(pointer p) const
229             { return this->is_internal_storage(p) || allocator_traits_type::storage_is_unpropagable(this->as_base(), p); }
230              
231             //!Swaps two allocators, does nothing
232             //!because this small_vector_allocator is stateless
233             BOOST_CONTAINER_FORCEINLINE friend void swap(small_vector_allocator &l, small_vector_allocator &r) BOOST_NOEXCEPT_OR_NOTHROW
234             { boost::adl_move_swap(l.as_base(), r.as_base()); }
235              
236             //!An small_vector_allocator always compares to true, as memory allocated with one
237             //!instance can be deallocated by another instance (except for unpropagable storage)
238             BOOST_CONTAINER_FORCEINLINE friend bool operator==(const small_vector_allocator &l, const small_vector_allocator &r) BOOST_NOEXCEPT_OR_NOTHROW
239             { return allocator_traits_type::equal(l.as_base(), r.as_base()); }
240              
241             //!An small_vector_allocator always compares to false, as memory allocated with one
242             //!instance can be deallocated by another instance
243             BOOST_CONTAINER_FORCEINLINE friend bool operator!=(const small_vector_allocator &l, const small_vector_allocator &r) BOOST_NOEXCEPT_OR_NOTHROW
244             { return !(l == r); }
245              
246             #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
247             /*
248             //!An advanced function that offers in-place expansion shrink to fit and new allocation
249             //!capabilities. Memory allocated with this function can only be deallocated with deallocate()
250             //!or deallocate_many().
251             //!This function is available only with Version == 2
252             pointer allocation_command(allocation_type command,
253             size_type limit_size,
254             size_type &prefer_in_recvd_out_size,
255             pointer &reuse)
256             { return allocator_traits_type::allocation_command(command, limit_size, prefer_in_recvd_out_size, reuse); }
257              
258             //!Returns maximum the number of objects the previously allocated memory
259             //!pointed by p can hold.
260             //!Memory must not have been allocated with
261             //!allocate_one or allocate_individual.
262             //!This function is available only with Version == 2
263             size_type size(pointer p) const BOOST_NOEXCEPT_OR_NOTHROW
264             { return allocator_traits_type::size(p); }
265             */
266             private:
267             /*
268             //!Allocates just one object. Memory allocated with this function
269             //!must be deallocated only with deallocate_one().
270             //!Throws bad_alloc if there is no enough memory
271             //!This function is available only with Version == 2
272             using Allocator::allocate_one;
273             using Allocator::allocate_individual;
274             using Allocator::deallocate_one;
275             using Allocator::deallocate_individual;
276             using Allocator::allocate_many;
277             using Allocator::deallocate_many;*/
278              
279             BOOST_CONTAINER_FORCEINLINE bool is_internal_storage(const_pointer p) const
280 0           { return this->internal_storage() == p; }
281              
282             BOOST_CONTAINER_FORCEINLINE
283             const_pointer internal_storage() const
284             {
285             typedef typename Allocator::value_type value_type;
286             typedef typename allocator_traits_type::size_type size_type;
287             typedef vector_alloc_holder< small_vector_allocator, size_type > vector_alloc_holder_t;
288             typedef vector > vector_base;
289             typedef small_vector_base derived_type;
290             //
291 0           const vector_alloc_holder_t &v_holder = static_cast(*this);
292 0           const vector_base &v_base = reinterpret_cast(v_holder);
293 0           const derived_type &d_base = static_cast(v_base);
294 0           return d_base.internal_storage();
295             }
296              
297             BOOST_CONTAINER_FORCEINLINE
298             pointer internal_storage()
299             {
300             typedef typename Allocator::value_type value_type;
301             typedef typename allocator_traits_type::size_type size_type;
302             typedef vector_alloc_holder< small_vector_allocator, size_type > vector_alloc_holder_t;
303             typedef vector > vector_base;
304             typedef small_vector_base derived_type;
305             //
306             vector_alloc_holder_t &v_holder = static_cast(*this);
307             vector_base &v_base = reinterpret_cast(v_holder);
308             derived_type &d_base = static_cast(v_base);
309             return d_base.internal_storage();
310             }
311             #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
312             };
313              
314             //! This class consists of common code from all small_vector types that don't depend on the
315             //! "N" template parameter. This class is non-copyable and non-destructible, so this class typically
316             //! used as reference argument to functions that read or write small vectors. Since `small_vector`
317             //! derives from `small_vector_base`, the conversion to `small_vector_base` is implicit
318             //!
 
319             //!
320             //! //Clients can pass any small_vector.
321             //! void read_any_small_vector_of_foo(const small_vector_base &in_parameter);
322             //!
323             //! void modify_any_small_vector_of_foo(small_vector_base &in_out_parameter);
324             //!
325             //! void some_function()
326             //! {
327             //!
328             //! small_vector myvector;
329             //!
330             //! read_any_small_vector_of_foo(myvector); // Reads myvector
331             //!
332             //! modify_any_small_vector_of_foo(myvector); // Modifies myvector
333             //!
334             //! }
335             //!
336             //!
337             //! All `boost::container:vector` member functions are inherited. See `vector` documentation for details.
338             //!
339             template
340 0           class small_vector_base
341             : public vector >
342             {
343             #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
344             public:
345             //Make it public as it will be inherited by small_vector and container
346             //must have this public member
347             typedef typename allocator_traits::pointer pointer;
348             typedef typename allocator_traits::const_pointer const_pointer;
349             typedef typename allocator_traits::void_pointer void_pointer;
350             typedef typename allocator_traits::const_void_pointer const_void_pointer;
351              
352             private:
353             BOOST_COPYABLE_AND_MOVABLE(small_vector_base)
354              
355             friend class small_vector_allocator;
356              
357             BOOST_CONTAINER_FORCEINLINE
358             const_pointer internal_storage() const BOOST_NOEXCEPT_OR_NOTHROW
359             {
360             typedef typename boost::intrusive::pointer_traits::template
361             rebind_pointer::type const_char_pointer;
362             const_void_pointer void_p = boost::intrusive::pointer_traits::
363 0           pointer_to(*m_storage_start.data);
364 0           return boost::intrusive::pointer_traits::static_cast_from(void_p);
365             }
366              
367             BOOST_CONTAINER_FORCEINLINE
368             pointer internal_storage() BOOST_NOEXCEPT_OR_NOTHROW
369             {
370             typedef typename boost::intrusive::pointer_traits::template
371             rebind_pointer::type char_pointer;
372             void_pointer void_p = boost::intrusive::pointer_traits::
373 0           pointer_to(*m_storage_start.data);
374 0           return boost::intrusive::pointer_traits::static_cast_from(void_p);
375             }
376              
377             typedef vector > base_type;
378             base_type &as_base() { return static_cast(*this); }
379             const base_type &as_base() const { return static_cast(*this); }
380              
381             public:
382             typedef typename dtl::aligned_storage
383             ::value>::type storage_type;
384             typedef small_vector_allocator allocator_type;
385              
386             protected:
387              
388             BOOST_CONTAINER_FORCEINLINE explicit small_vector_base(initial_capacity_t, std::size_t initial_capacity)
389 0           : base_type(initial_capacity_t(), this->internal_storage(), initial_capacity)
390             {}
391              
392             template
393             BOOST_CONTAINER_FORCEINLINE explicit small_vector_base(initial_capacity_t, std::size_t capacity, BOOST_FWD_REF(AllocFwd) a)
394             : base_type(initial_capacity_t(), this->internal_storage(), capacity, ::boost::forward(a))
395             {}
396              
397             //~small_vector_base(){}
398              
399             private:
400             //The only member
401             storage_type m_storage_start;
402              
403             #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
404              
405             public:
406             BOOST_CONTAINER_FORCEINLINE small_vector_base& operator=(BOOST_COPY_ASSIGN_REF(small_vector_base) other)
407             { return static_cast(this->base_type::operator=(static_cast(other))); }
408              
409             BOOST_CONTAINER_FORCEINLINE small_vector_base& operator=(BOOST_RV_REF(small_vector_base) other)
410             { return static_cast(this->base_type::operator=(BOOST_MOVE_BASE(base_type, other))); }
411              
412             BOOST_CONTAINER_FORCEINLINE void swap(small_vector_base &other)
413             { return this->base_type::swap(other); }
414              
415             #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
416             protected:
417             void move_construct_impl(base_type &x, const allocator_type &a)
418             {
419             if(base_type::is_propagable_from(x.get_stored_allocator(), x.data(), a, true)){
420             this->steal_resources(x);
421             }
422             else{
423             this->assign( boost::make_move_iterator(boost::movelib::iterator_to_raw_pointer(x.begin()))
424             , boost::make_move_iterator(boost::movelib::iterator_to_raw_pointer(x.end ()))
425             );
426             }
427             }
428             #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
429             };
430              
431             #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
432              
433             /////////////////////////////////////////////////////
434             //
435             // small_vector_storage_calculator
436             //
437             /////////////////////////////////////////////////////
438             template
439             struct small_vector_storage_calculator_helper
440             {
441             static const std::size_t value = (Needed - Hdr - 1u)/SSize + 1u;
442             };
443              
444             template
445             struct small_vector_storage_calculator_helper
446             {
447             static const std::size_t value = 0u;
448             };
449              
450             template
451             struct small_vector_storage_calculator
452             {
453             typedef small_vector_base svh_type;
454             typedef vector > svhb_type;
455             static const std::size_t s_align = dtl::alignment_of::value;
456             static const std::size_t s_size = sizeof(Storage);
457             static const std::size_t svh_sizeof = sizeof(svh_type);
458             static const std::size_t svhb_sizeof = sizeof(svhb_type);
459             static const std::size_t s_start = ((svhb_sizeof-1)/s_align+1)*s_align;
460             static const std::size_t header_bytes = svh_sizeof-s_start;
461             static const std::size_t needed_bytes = sizeof(T)*N;
462             static const std::size_t needed_extra_storages =
463             small_vector_storage_calculator_helper::value;
464             };
465              
466             /////////////////////////////////////////////////////
467             //
468             // small_vector_storage_definer
469             //
470             /////////////////////////////////////////////////////
471             template
472 0           struct small_vector_storage
473             {
474             Storage m_rest_of_storage[N];
475             };
476              
477             template
478             struct small_vector_storage
479             {};
480              
481             template
482             struct small_vector_storage_definer
483             {
484             typedef typename Allocator::value_type value_type;
485             typedef typename small_vector_base::storage_type storage_type;
486             static const std::size_t needed_extra_storages =
487             small_vector_storage_calculator::needed_extra_storages;
488             typedef small_vector_storage type;
489             };
490              
491             #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
492              
493             //! small_vector is a vector-like container optimized for the case when it contains few elements.
494             //! It contains some preallocated elements in-place, which can avoid the use of dynamic storage allocation
495             //! when the actual number of elements is below that preallocated threshold.
496             //!
497             //! `small_vector` is convertible to `small_vector_base` that is independent
498             //! from the preallocated element capacity, so client code does not need to be templated on that N argument.
499             //!
500             //! All `boost::container::vector` member functions are inherited. See `vector` documentation for details.
501             //!
502             //! \tparam T The type of object that is stored in the small_vector
503             //! \tparam N The number of preallocated elements stored inside small_vector. It shall be less than Allocator::max_size();
504             //! \tparam Allocator The allocator used for memory management when the number of elements exceeds N.
505             template ) >
506 0           class small_vector : public small_vector_base
507             #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
508             , private small_vector_storage_definer::type
509             #endif
510             {
511             #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
512             typedef small_vector_base base_type;
513             typedef typename small_vector_storage_definer::type remaining_storage_holder;
514              
515             BOOST_COPYABLE_AND_MOVABLE(small_vector)
516              
517             typedef allocator_traits allocator_traits_type;
518              
519             public:
520             typedef small_vector_storage_calculator< typename small_vector_base
521             ::storage_type, Allocator, T, N> storage_test;
522              
523             static const std::size_t needed_extra_storages = storage_test::needed_extra_storages;
524             static const std::size_t needed_bytes = storage_test::needed_bytes;
525             static const std::size_t header_bytes = storage_test::header_bytes;
526             static const std::size_t s_start = storage_test::s_start;
527              
528             typedef typename base_type::allocator_type allocator_type;
529             typedef typename base_type::size_type size_type;
530             typedef typename base_type::value_type value_type;
531              
532             BOOST_CONTAINER_FORCEINLINE static std::size_t internal_capacity()
533 0           { return (sizeof(small_vector) - storage_test::s_start)/sizeof(T); }
534              
535             #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
536              
537             //! @brief The capacity/max size of the container
538             static const size_type static_capacity = N;
539              
540             public:
541             BOOST_CONTAINER_FORCEINLINE small_vector()
542             BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible::value)
543 0           : base_type(initial_capacity_t(), internal_capacity())
544             {}
545              
546             BOOST_CONTAINER_FORCEINLINE explicit small_vector(const allocator_type &a)
547             : base_type(initial_capacity_t(), internal_capacity(), a)
548             {}
549              
550             BOOST_CONTAINER_FORCEINLINE explicit small_vector(size_type n)
551             : base_type(initial_capacity_t(), internal_capacity())
552             { this->resize(n); }
553              
554             BOOST_CONTAINER_FORCEINLINE small_vector(size_type n, const allocator_type &a)
555             : base_type(initial_capacity_t(), internal_capacity(), a)
556             { this->resize(n); }
557              
558             BOOST_CONTAINER_FORCEINLINE small_vector(size_type n, default_init_t)
559             : base_type(initial_capacity_t(), internal_capacity())
560             { this->resize(n, default_init_t()); }
561              
562             BOOST_CONTAINER_FORCEINLINE small_vector(size_type n, default_init_t, const allocator_type &a)
563             : base_type(initial_capacity_t(), internal_capacity(), a)
564             { this->resize(n, default_init_t()); }
565              
566             BOOST_CONTAINER_FORCEINLINE small_vector(size_type n, const value_type &v)
567             : base_type(initial_capacity_t(), internal_capacity())
568             { this->resize(n, v); }
569              
570             BOOST_CONTAINER_FORCEINLINE small_vector(size_type n, const value_type &v, const allocator_type &a)
571             : base_type(initial_capacity_t(), internal_capacity(), a)
572             { this->resize(n, v); }
573              
574             template
575             BOOST_CONTAINER_FORCEINLINE small_vector(InIt first, InIt last
576             BOOST_CONTAINER_DOCIGN(BOOST_MOVE_I typename dtl::disable_if_c
577             < dtl::is_convertible::value
578             BOOST_MOVE_I dtl::nat >::type * = 0)
579             )
580             : base_type(initial_capacity_t(), internal_capacity())
581             { this->assign(first, last); }
582              
583             template
584             BOOST_CONTAINER_FORCEINLINE small_vector(InIt first, InIt last, const allocator_type& a
585             BOOST_CONTAINER_DOCIGN(BOOST_MOVE_I typename dtl::disable_if_c
586             < dtl::is_convertible::value
587             BOOST_MOVE_I dtl::nat >::type * = 0)
588             )
589             : base_type(initial_capacity_t(), internal_capacity(), a)
590             { this->assign(first, last); }
591              
592             BOOST_CONTAINER_FORCEINLINE small_vector(const small_vector &other)
593             : base_type( initial_capacity_t(), internal_capacity()
594             , allocator_traits_type::select_on_container_copy_construction(other.get_stored_allocator()))
595             { this->assign(other.cbegin(), other.cend()); }
596              
597             BOOST_CONTAINER_FORCEINLINE small_vector(const small_vector &other, const allocator_type &a)
598             : base_type(initial_capacity_t(), internal_capacity(), a)
599             { this->assign(other.cbegin(), other.cend()); }
600              
601             BOOST_CONTAINER_FORCEINLINE explicit small_vector(const base_type &other)
602             : base_type( initial_capacity_t(), internal_capacity()
603             , allocator_traits_type::select_on_container_copy_construction(other.get_stored_allocator()))
604             { this->assign(other.cbegin(), other.cend()); }
605              
606             BOOST_CONTAINER_FORCEINLINE explicit small_vector(BOOST_RV_REF(base_type) other)
607             : base_type(initial_capacity_t(), internal_capacity(), ::boost::move(other.get_stored_allocator()))
608             { this->move_construct_impl(other, other.get_stored_allocator()); }
609              
610             BOOST_CONTAINER_FORCEINLINE small_vector(BOOST_RV_REF(small_vector) other)
611             BOOST_NOEXCEPT_IF(boost::container::dtl::is_nothrow_move_assignable::value)
612             : base_type(initial_capacity_t(), internal_capacity(), ::boost::move(other.get_stored_allocator()))
613             { this->move_construct_impl(other, other.get_stored_allocator()); }
614              
615             BOOST_CONTAINER_FORCEINLINE small_vector(BOOST_RV_REF(small_vector) other, const allocator_type &a)
616             : base_type(initial_capacity_t(), internal_capacity(), a)
617             { this->move_construct_impl(other, a); }
618              
619             #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
620             BOOST_CONTAINER_FORCEINLINE small_vector(std::initializer_list il, const allocator_type& a = allocator_type())
621             : base_type(initial_capacity_t(), internal_capacity(), a)
622             {
623             this->assign(il.begin(), il.end());
624             }
625             #endif
626              
627             BOOST_CONTAINER_FORCEINLINE small_vector& operator=(BOOST_COPY_ASSIGN_REF(small_vector) other)
628             { return static_cast(this->base_type::operator=(static_cast(other))); }
629              
630             BOOST_CONTAINER_FORCEINLINE small_vector& operator=(BOOST_RV_REF(small_vector) other)
631             BOOST_NOEXCEPT_IF(boost::container::dtl::is_nothrow_move_assignable::value
632             && (allocator_traits_type::propagate_on_container_move_assignment::value
633             || allocator_traits_type::is_always_equal::value))
634             { return static_cast(this->base_type::operator=(BOOST_MOVE_BASE(base_type, other))); }
635              
636             BOOST_CONTAINER_FORCEINLINE small_vector& operator=(const base_type &other)
637             { return static_cast(this->base_type::operator=(other)); }
638              
639             BOOST_CONTAINER_FORCEINLINE small_vector& operator=(BOOST_RV_REF(base_type) other)
640             { return static_cast(this->base_type::operator=(boost::move(other))); }
641              
642             BOOST_CONTAINER_FORCEINLINE void swap(small_vector &other)
643             { return this->base_type::swap(other); }
644             };
645              
646             }}
647              
648             #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
649             /*
650             namespace boost {
651              
652             //!has_trivial_destructor_after_move<> == true_type
653             //!specialization for optimizations
654             template
655             struct has_trivial_destructor_after_move >
656             {
657             typedef typename ::boost::container::allocator_traits::pointer pointer;
658             static const bool value = ::boost::has_trivial_destructor_after_move::value &&
659             ::boost::has_trivial_destructor_after_move::value;
660             };
661              
662             }
663             */
664             #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
665              
666             #include
667              
668             #endif // #ifndef BOOST_CONTAINER_CONTAINER_SMALL_VECTOR_HPP