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

📄 vector_of.qbk

📁 Boost provides free peer-reviewed portable C++ source libraries. We emphasize libraries that work
💻 QBK
📖 第 1 页 / 共 3 页
字号:
[/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 vector_of Reference][section Header "boost/bimap/vector_of.hpp" synopsis]    namespace boost {    namespace bimaps {    template< class KeyType >    struct vector_of;    struct vector_of_relation;    } // namespace bimap    } // namespace boost[endsect][section vector_of views]vector_of views are free-order sequences with constant time positionalaccess and random access iterators. Elements in a vector_of view are bydefault sorted according to their order of insertion: this means that new elementsinserted through a different view of the `bimap` are appended tothe end of the vector_of view; additionally, facilities are provided forfurther rearrangement of the elements. The public interface of vector_of viewsincludes that of list_of views, with differences in the complexityof the operations, plus extra operations for positional access(`operator[]` and `at()`) and for capacity handling. Validity of iterators andreferences to elements is preserved in all operations, regardless of thecapacity status.As is the case with list_of views, vector_of views have the followinglimitations with respect to STL sequence containers:* vector_of viewsare not __SGI_ASSIGNABLE__ (like any other view.)* Insertions into a vector_of view may fail due to clashings with other views.This alters the semantics of the operations provided with respect to their analoguesin STL sequence containers.* Elements in a vector_of view are not mutable, and can only be changed bymeans of replace and modify member functions.Having these restrictions into account, vector of views are models of__SGI_RANDOM_ACCESS_CONTAINER__ and __SGI_BACK_INSERTION_SEQUENCE__. Although these viewsdo not model __SGI_FRONT_INSERTION_SEQUENCE__, because front insertion and deletiontake linear time, front operations are nonetheless provided to match the interfaceof list_of views. We only describe those types and operations that are eithernot present in the concepts modeled or do not exactly conform to the requirementsfor 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=(this_type & x);        template< class InputIterator >        void ``[link reference_vector_of_assign_iterator_iterator assign]``(InputIterator first, InputIterator last);        void ``[link reference_vector_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;        size_type ``[link reference_vector_of_capacity capacity]``() const;        void ``[link reference_vector_of_reserve_size reserve]``(size_type m);        void ``[link reference_vector_of_resize_size_value resize]``(size_type n, const value_type & x = value_type());        // access        const_reference operator[](size_type n) const;        const_reference at(size_type n) const;        const_reference front() const;        const_reference back() const;        // modifiers        std::pair<iterator,bool> ``[link reference_vector_of_push_front_value push_front]``(const value_type & x);        void                     pop_front();        std::pair<iterator,bool> ``[link reference_vector_of_push_back_value push_back]``(const value_type & x);        void                     pop_back();        std::pair<iterator,bool> ``[link reference_vector_of_insert_iterator_value insert]``(iterator position, const value_type & x);        void ``[link reference_vector_of_insert_iterator_size_value insert]``(iterator position, size_type m, const value_type & x);        template< class InputIterator>        void ``[link reference_vector_of_insert_iterator_iterator_iterator insert]``(iterator position, InputIterator first, InputIterator last);        iterator ``[link reference_vector_of_erase_iterator erase]``(iterator position);        iterator ``[link reference_vector_of_erase_iterator_iterator erase]``(iterator first, iterator last);        bool ``[link reference_vector_of_replace_iterator_value replace]``(iterator position, const value_type & x);        // Only in map views        // {          template< class CompatibleKey >          bool ``[link reference_vector_of_replace_key_iterator_key replace_key]``(iterator position, const CompatibleKey & x);          template< class CompatibleData >          bool ``[link reference_vector_of_replace_data_iterator_data replace_data]``(iterator position, const CompatibleData & x);          template< class KeyModifier >          bool ``[link reference_vector_of_modify_key_iterator_modifier modify_key]``(iterator position, KeyModifier mod);          template< class DataModifier >          bool ``[link reference_vector_of_modify_data_iterator_modifier modify_data]``(iterator position, DataModifier mod);        // }        void clear();        // list operations        void ``[link reference_vector_of_splice_iterator_this splice]``(iterator position, this_type & x);        void ``[link reference_vector_of_splice_iterator_this_iterator splice]``(iterator position, this_type & x, iterator i);        void ``[link reference_vector_of_splice_iterator_this_iterator_iterator splice]``(            iterator position, this_type & x, iterator first, iterator last);        void ``[link reference_vector_of_remove_value remove]``(const value_type & value);        template< class Predicate >        void ``[link reference_vector_of_remove_if_predicate remove_if]``(Predicate pred);        void ``[link reference_vector_of_unique unique]``();        template< class BinaryPredicate >        void ``[link reference_vector_of_unique_predicate unique]``(BinaryPredicate binary_pred);        void ``[link reference_vector_of_merge_this merge]``(this_type & x);        template< typename Compare >        void ``[link reference_vector_of_merge_this_compare merge]``(this_type & x, Compare comp);        void ``[link reference_vector_of_sort sort]``();        template< typename Compare >        void ``[link reference_vector_of_sort_compare sort]``(Compare comp);        void ``[link reference_vector_of_reverse reverse]``();        // rearrange operations        void ``[link reference_vector_of_relocate_iterator_iterator relocate]``(iterator position, iterator i);        void ``[link reference_vector_of_relocate_iterator_iterator_iterator 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< vector_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;[#vector_of_complexity_signature][section Complexity signature]Here and in the descriptions of operations of `vector_of` views, we adoptthe scheme outlined in the[link complexity_signature_explanation complexity signature section].The complexity signature of `vector_of` view is:* copying: `c(n) = n * log(n)`,* insertion: `i(n) = 1` (amortized constant),* hinted insertion: `h(n) = 1` (amortized constant),* deletion: `d(n) = m`, where m is the distance from the deleted element to theend of the sequence,* replacement: `r(n) = 1` (constant),* modifying: `m(n) = 1` (constant).The following expressions are also used as a convenience for writing down someof the complexity formulas:[blurb`shl(a,b) = a+b` if a is nonzero, 0 otherwise.`rel(a,b,c) =` if `a<b`, `c-a`, else `a-b`,](`shl` and `rel` stand for ['shift left] and ['relocate], respectively.)

⌨️ 快捷键说明

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