⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 list_of.qbk

📁 Boost provides free peer-reviewed portable C++ source libraries. We emphasize libraries that work
💻 QBK
📖 第 1 页 / 共 2 页
字号:
[/licenseBoost.BimapCopyright (c) 2006-2007 Matias CapelettoDistributed under the Boost Software License, Version 1.0.(See accompanying file LICENSE_1_0.txt or copy athttp://www.boost.org/LICENSE_1_0.txt)][/ QuickBook Document version 1.4 ][section list_of Reference][section Header "boost/bimap/list_of.hpp" synopsis]    namespace boost {    namespace bimaps {    template< class KeyType >    struct list_of;    struct list_of_relation;    } // namespace bimap    } // namespace boost[endsect][section list_of Views]A list_of set view is a std::list signature compatibleinterface to the underlying heap of elements contained in a `bimap`.If you look the bimap by a side, you will use a map view and if you lookedit as a whole you will be using a set view.Elements in a list_of view are by default sorted according totheir order of insertion: this means that new elements inserted through adifferent view of the `bimap` are appended to the end of thelist_of view. Additionally, the view allows for free reordering of elementsin the same vein as `std::list` does. Validity of iterators and references toelements is preserved in all operations.There are a number of differences with respect to `std::lists`:* list_of views are not__SGI_ASSIGNABLE__ (like any other view.)* Unlike as in `std::list`, insertions into a list_of view may fail due toclashings with other views. This alters the semantics of the operationsprovided with respect to their analogues in `std::list`.* Elements in a list_of view are not mutable, and can only be changedby means of `replace` and `modify` member functions.Having these restrictions into account, list_of views are models of__SGI_REVERSIBLE_CONTAINER__, __SGI_FRONT_INSERTION_SEQUENCE__ and__SGI_BACK_INSERTION_SEQUENCE__.We only provide descriptions of those types and operations that are eithernot present in the concepts modeled or do not exactly conform to therequirements for these types of containers.    namespace boost {    namespace bimaps {    namespace views {    template< ``['-implementation defined parameter list-]`` >    class ``['-implementation defined view name-]``    {        public:        // types        typedef ``['-unspecified-]`` value_type;        typedef ``['-unspecified-]`` allocator_type;        typedef ``['-unspecified-]`` reference;        typedef ``['-unspecified-]`` const_reference;        typedef ``['-unspecified-]`` iterator;        typedef ``['-unspecified-]`` const_iterator;        typedef ``['-unspecified-]`` size_type;        typedef ``['-unspecified-]`` difference_type;        typedef ``['-unspecified-]`` pointer;        typedef ``['-unspecified-]`` const_pointer;        typedef ``['-unspecified-]`` reverse_iterator;        typedef ``['-unspecified-]`` const_reverse_iterator;        typedef ``['-unspecified-]`` info_type;        // construct/copy/destroy        this_type & operator=(const this_type & x);        template< class InputIterator >        void ``[link reference_list_of_assign_iterator_iterator assign]``(InputIterator first, InputIterator last);        void ``[link reference_list_of_assign_size_value assign]``(size_type n, const value_type & value);        allocator_type get_allocator() const;        // iterators        iterator               begin();        const_iterator         begin() const;        iterator               end();        const_iterator         end() const;        reverse_iterator       rbegin();        const_reverse_iterator rbegin() const;        reverse_iterator       rend();        const_reverse_iterator rend() const;        // capacity        bool      empty() const;        size_type size() const;        size_type max_size() const;        void ``[link reference_list_of_resize_size_value resize]``(size_type n, const value_type & x = value_type());        // access        const_reference front() const;        const_reference back() const;        // modifiers        std::pair<iterator,bool> ``[link reference_list_of_push_front_value push_front]``(const value_type & x);        void                     pop_front();        std::pair<iterator,bool> ``[link reference_list_of_push_back_value push_back]``(const value_type & x);        void                     pop_back();        std::pair<iterator,bool> ``[link reference_list_of_insert_iterator_value insert]``(iterator position, const value_type & x);        void ``[link reference_list_of_insert_iterator_size_value insert]``(iterator position, size_type n, const value_type & x);        template< class InputIterator >        void ``[link reference_list_of_insert_iterator_iterator_iterator insert]``(iterator position, InputIterator first, InputIterator last);        iterator ``[link reference_list_of_erase_iterator erase]``(iterator position);        iterator ``[link reference_list_of_erase_iterator_iterator erase]``(iterator first, iterator last);        bool ``[link reference_list_of_replace_iterator_value replace]``(iterator position, const value_type & x);        // Only in map views        // {          template< class CompatibleKey >          bool ``[link reference_list_of_replace_key_iterator_key replace_key]``(iterator position, const CompatibleKey & x);          template< class CompatibleData >          bool ``[link reference_list_of_replace_data_iterator_data replace_data]``(iterator position, const CompatibleData & x);          template< class KeyModifier >          bool ``[link reference_list_of_modify_key_iterator_modifier modify_key]``(iterator position, KeyModifier mod);          template< class DataModifier >          bool ``[link reference_list_of_modify_data_iterator_modifier modify_data]``(iterator position, DataModifier mod);        // }        void clear();        // list operations        void ``[link reference_list_of_splice_iterator_this splice]``(iterator position, this_type & x);        void ``[link reference_list_of_splice_iterator_this_iterator splice]``(iterator position, this_type & x, iterator i);        void splice(            iterator position, this_type & x, iterator first, iterator last);        void ``[link reference_list_of_remove_value remove]``(const value_type & value);        template< class Predicate >        void ``[link reference_list_of_remove_if_predicate remove_if]``(Predicate pred);        void ``[link reference_list_of_unique unique]``();        template< class BinaryPredicate >        void ``[link reference_list_of_unique_predicate unique]``(BinaryPredicate binary_pred);        void ``[link reference_list_of_merge_this merge]``(this_type & x);        template< class Compare >        void ``[link reference_list_of_merge_this_compare merge]``(this_type & x,Compare comp);        void ``[link reference_list_of_sort sort]``();        template< class Compare >        void ``[link reference_list_of_sort_compare sort]``(Compare comp);        void ``[link reference_list_of_reverse reverse]``();        // rearrange operations        void relocate(iterator position, iterator i);        void relocate(iterator position, iterator first, iterator last);    }    // view comparison    bool operator==(const this_type & v1, const this_type & v2 );    bool operator< (const this_type & v1, const this_type & v2 );    bool operator!=(const this_type & v1, const this_type & v2 );    bool operator> (const this_type & v1, const this_type & v2 );    bool operator>=(const this_type & v1, const this_type & v2 );    bool operator<=(const this_type & v1, const this_type & v2 );    } // namespace views    } // namespace bimap    } // namespace boostIn the case of a `bimap< list_of<Left>, ... >`In the set view:    typedef signature-compatible with relation< Left, ... > key_type;    typedef signature-compatible with relation< Left, ... > value_type;In the left map view:    typedef  Left  key_type;    typedef  ...   data_type;    typedef signature-compatible with std::pair< Left, ... > value_type;In the right map view:    typedef  ...  key_type;    typedef  Left data_type;    typedef signature-compatible with std::pair< ... , Left > value_type;[#list_of_complexity_signature][section Complexity signature]Here and in the descriptions of operations of `list_of` views, we adopt thescheme outlined in the[link complexity_signature_explanation complexity signature section].The complexity signature of a `list_of` view is:* copying: `c(n) = n * log(n)`,* insertion: `i(n) = 1` (constant),* hinted insertion: `h(n) = 1` (constant),* deletion: `d(n) = 1` (constant),* replacement: `r(n) = 1` (constant),* modifying: `m(n) = 1` (constant).[endsect][section Instantiation types]`list_of` views are instantiated internally to `bimap` and specifiedby means of the collection type specifiers and the bimap itself.Instantiations are dependent on the following types:* `Value` from `list_of`,* `Allocator` from `bimap`,[endsect][section Constructors, copy and assignment]As explained in the view concepts section, views do not have publicconstructors or destructors. Assignment, on the other hand, is provided.    this_type & operator=(const this_type & x);* [*Effects: ] `a = b;`where a and b are the `bimap` objects to which `*this` and `x` belong,respectively.* [*Returns: ] `*this`.[#reference_list_of_assign_iterator_iterator]    template< class InputIterator >    void assign(InputIterator first, InputIterator last);* [*Requires: ] `InputIterator` is a model of __SGI_INPUT_ITERATOR__ over elements of type`value_type` or a type convertible to `value_type`. first and last are notiterators into any views of the `bimap` to which this view belongs.`last` is reachable from `first`.* [*Effects: ] `clear(); insert(end(),first,last);`[#reference_list_of_assign_size_value]    void assign(size_type n, const value_type & value);* [*Effects: ] `clear(); for(size_type i = 0; i < n ; ++n) push_back(v);`[endsect][section Capacity operations][#reference_list_of_resize_size_value]    void resize(size_type n,const value_type& x=value_type()); * [*Effects: ]`if( n > size() ) insert(end(), n - size(), x);``else if( n < size() ) {``    iterator it = begin();``    std::advance(it, n);``    erase(it, end());``}`* [*Note:] If an expansion is requested, the size of the view is notguaranteed to be n after this operation (other views may ban insertions.)[endsect][section Modifiers][#reference_list_of_push_front_value]    std::pair<iterator,bool> push_front(const value_type& x);* [*Effects:] Inserts `x` at the beginning of the sequence if no other viewsof the `bimap` bans the insertion.* [*Returns:] The return value is a pair `p`. `p.second` is `true` if and onlyif insertion took place. On successful insertion, `p.first` points to the elementinserted; otherwise, `p.first` points to an element that caused the insertion to bebanned. Note that more than one element can be causing insertion not to be allowed.* [link list_of_complexity_signature [*Complexity:]] O(I(n)).* [*Exception safety:] Strong.[#reference_list_of_push_back_value]    std::pair<iterator,bool> push_back(const value_type & x);* [*Effects:] Inserts `x` at the end of the sequence if no other views of the`bimap` bans the insertion.* [*Returns:] The return value is a pair `p`. `p.second` is `true` if and only ifinsertion took place. On successful insertion, `p.first` points to the elementinserted; otherwise, `p.first` points to an element that caused the insertionto be banned. Note that more than one element can be causing insertion notto be allowed.* [link list_of_complexity_signature [*Complexity:]] O(I(n)).* [*Exception safety:] Strong.[#reference_list_of_insert_iterator_value]    std::pair<iterator,bool> insert(iterator position, const value_type & x);* [*Requires: ] `position` is a valid `iterator` of the view.* [*Effects:] Inserts `x` before position if insertion is allowed by all otherviews of the `bimap`.* [*Returns:] The return value is a pair `p`. `p.second` is `true` if and only ifinsertion took place. On successful insertion, `p.first` points to the elementinserted; otherwise, `p.first` points to an element that caused the insertionto be banned. Note that more than one element can be causing insertion notto be allowed.* [link list_of_complexity_signature [*Complexity:]] O(I(n)).* [*Exception safety:] Strong.[#reference_list_of_insert_iterator_size_value]    void insert(iterator position, size_type n, const value_type & x);* [*Requires: ] `position` is a valid `iterator` of the view.* [*Effects: ] `for(size_type i = 0; i < n; ++i) insert(position, x);`[#reference_list_of_insert_iterator_iterator_iterator]    template< class InputIterator>    void insert(iterator position,InputIterator first,InputIterator last);* [*Requires: ] `position` is a valid `iterator` of the view. `InputIterator` isa model of __SGI_INPUT_ITERATOR__ over elements of type `value_type`.`first` and `last` are not iterators into any view of the`bimap` to which this view belongs. `last` is reachable from `first`.* [*Effects: ] `while(first != last) insert(position, *first++);`* [link list_of_complexity_signature [*Complexity:]] O(m*I(n+m)), where m is the number of elements in `[first,last)`.* [*Exception safety:] Basic.[#reference_list_of_erase_iterator]    iterator erase(iterator position);* [*Requires: ] `position` is a valid dereferenceable `iterator` of the view.* [*Effects:] Deletes the element pointed to by `position`.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -