diff options
Diffstat (limited to 'libstdc++-v3/include/bits/stl_list.h')
| -rw-r--r-- | libstdc++-v3/include/bits/stl_list.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/libstdc++-v3/include/bits/stl_list.h b/libstdc++-v3/include/bits/stl_list.h index 08fb89ef117..b38fa55cf79 100644 --- a/libstdc++-v3/include/bits/stl_list.h +++ b/libstdc++-v3/include/bits/stl_list.h @@ -63,6 +63,7 @@ #define _STL_LIST_H 1 #include <bits/concept_check.h> +#include <initializer_list> _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) @@ -541,6 +542,19 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) */ list(list&& __x) : _Base(std::forward<_Base>(__x)) { } + + /** + * @brief Builds a %list from an initializer_list + * @param l An initializer_list of value_type. + * @param a An allocator object. + * + * Create a %list consisting of copies of the elements in the + * initializer_list @a l. This is linear in l.size(). + */ + list(initializer_list<value_type> __l, + const allocator_type& __a = allocator_type()) + : _Base(__a) + { _M_initialize_dispatch(__l.begin(), __l.end(), __false_type()); } #endif /** @@ -597,6 +611,20 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) this->swap(__x); return *this; } + + /** + * @brief %List initializer list assignment operator. + * @param l An initializer_list of value_type. + * + * Replace the contents of the %list with copies of the elements + * in the initializer_list @a l. This is linear in l.size(). + */ + list& + operator=(initializer_list<value_type> __l) + { + this->assign(__l.begin(), __l.end()); + return *this; + } #endif /** @@ -634,6 +662,19 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) _M_assign_dispatch(__first, __last, _Integral()); } +#ifdef __GXX_EXPERIMENTAL_CXX0X__ + /** + * @brief Assigns an initializer_list to a %list. + * @param l An initializer_list of value_type. + * + * Replace the contents of the %list with copies of the elements + * in the initializer_list @a l. This is linear in l.size(). + */ + void + assign(initializer_list<value_type> __l) + { this->assign(__l.begin(), __l.end()); } +#endif + /// Get a copy of the memory allocation object. allocator_type get_allocator() const @@ -951,6 +992,23 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_D) iterator insert(iterator __position, value_type&& __x) { return emplace(__position, std::move(__x)); } + + /** + * @brief Inserts the contents of an initializer_list into %list + * before specified iterator. + * @param p An iterator into the %list. + * @param l An initializer_list of value_type. + * + * This function will insert copies of the data in the + * initializer_list @a l into the %list before the location + * specified by @a p. + * + * This operation is linear in the number of elements inserted and + * does not invalidate iterators and references. + */ + void + insert(iterator __p, initializer_list<value_type> __l) + { this->insert(__p, __l.begin(), __l.end()); } #endif /** |

