| 908 | //! Construct a new element at the end of the space optimized circular buffer. |
| 909 | /*! |
| 910 | \post if <code>capacity().%capacity() > 0</code> then <code>back() == item</code><br> |
| 911 | If the <code>circular_buffer_space_optimized</code> is full, the first element will be removed. If the |
| 912 | capacity is <code>0</code>, nothing will be inserted.<br><br> |
| 913 | The amount of allocated memory in the internal buffer may be predictively increased. |
| 914 | \param item The element to be inserted. |
| 915 | \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is |
| 916 | used). |
| 917 | Whatever <code>T::T(Args...)</code> throws. |
| 918 | Whatever <code>T::operator = (T&&)</code> throws. |
| 919 | \par Exception Safety |
| 920 | Basic. |
| 921 | \par Iterator Invalidation |
| 922 | Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except iterators |
| 923 | equal to <code>end()</code>). |
| 924 | \par Complexity |
| 925 | Linear (in the size of the <code>circular_buffer_space_optimized</code>). |
| 926 | \sa <code>\link push_front() push_front(const_reference)\endlink</code>, <code>pop_back()</code>, |
| 927 | <code>pop_front()</code> |
| 928 | */ |
| 929 | template <class ...Args> |
| 930 | void emplace_back(BOOST_FWD_REF(Args) ...args) { |
| 931 | check_low_capacity(); |
| 932 | circular_buffer<T, Alloc>::emplace_back(::boost::forward<Args>(args)...); |
| 933 | } |
| 934 | |
| 935 | //! Construct a new element at the beginning of the space optimized circular buffer. |
| 936 | /*! |
| 937 | \post if <code>capacity().%capacity() > 0</code> then <code>front() == item</code><br> |
| 938 | If the <code>circular_buffer_space_optimized</code> is full, the last element will be removed. If the |
| 939 | capacity is <code>0</code>, nothing will be inserted.<br><br> |
| 940 | The amount of allocated memory in the internal buffer may be predictively increased. |
| 941 | \param item The element to be inserted. |
| 942 | \throws "An allocation error" if memory is exhausted (<code>std::bad_alloc</code> if the standard allocator is |
| 943 | used). |
| 944 | Whatever <code>T::T(Args...)</code> throws or nothing if <code>T::T(T&&)</code> is noexcept. |
| 945 | Whatever <code>T::operator = (T&&)</code> throws. |
| 946 | \par Exception Safety |
| 947 | Basic. |
| 948 | \par Iterator Invalidation |
| 949 | Invalidates all iterators pointing to the <code>circular_buffer_space_optimized</code> (except iterators |
| 950 | equal to <code>end()</code>). |
| 951 | \par Complexity |
| 952 | Linear (in the size of the <code>circular_buffer_space_optimized</code>). |
| 953 | \sa <code>\link push_back() push_back(const_reference)\endlink</code>, <code>pop_back()</code>, |
| 954 | <code>pop_front()</code> |
| 955 | */ |
| 956 | template <class ...Args> |
| 957 | void emplace_front(BOOST_FWD_REF(Args) ...args) { |
| 958 | check_low_capacity(); |
| 959 | circular_buffer<T, Alloc>::emplace_front(::boost::forward<Args>(args)...); |
| 960 | } |
| 961 | |