[ Web Proxy ]
URL:
Viewing: https://ru.cppreference.com/cpp/container/set/set [Back]  [Original]

std::set::set cppreference.com
cppreference.com

std::set::set

cppreference.com

<metanoindex/>

<tbody> </tbody> <tbody class="t-dcl-rev t-dcl-rev-num "> </tbody><tbody> </tbody> <tbody class="t-dcl-rev t-dcl-rev-num "> </tbody><tbody> </tbody> <tbody class="t-dcl-rev t-dcl-rev-num "> </tbody><tbody> </tbody>
(1)
explicit set( const Compare& comp = Compare(), {{#pad:|12}} const Allocator& alloc = Allocator() );
( C++14)
set() : set( Compare() ) {} explicit set( const Compare& comp, {{#pad:|12}} const Allocator& alloc = Allocator() );
( C++14)
explicit set( const Allocator& alloc );
(1) ( C++11)
(2)
template< class InputIterator > set( InputIterator first, InputIterator last, {{#pad:|3}} const Compare& comp = Compare(), {{#pad:|3}} const Allocator& alloc = Allocator() );
template< class InputIterator > set( InputIterator first, InputIterator last, {{#pad:|3}} const Allocator& alloc );
( C++14)
set( const set& other );
(3)
set( const set& other, const Allocator& alloc );
(3) ( C++11)
set( set&& other );
(4) ( C++11)
set( set&& other, const Allocator& alloc );
(4) ( C++11)
(5)
set( std::initializer_list<value_type> init, {{#pad:|3}} const Compare& comp = Compare(), {{#pad:|3}} const Allocator& alloc = Allocator() );
( C++11)
set( std::initializer_list<value_type> init, {{#pad:|3}} const Allocator& );
( C++14)

() alloc comp.

1)
. .
:
default constructor. Constructs empty container.
Google.
. .
2)
[first, last).
:
constructs the container with the contents of the range [first, last).
Google.
. .
3)
. other. alloc , std::allocator_traits<allocator_type>::select_on_container_copy_construction(other.get_allocator()).
:
copy constructor. Constructs the container with the copy of the contents of other. If alloc is not provided, allocator is obtained by calling std::allocator_traits<allocator_type>::select_on_copy_construction(other).
Google.
. .
4)
Move-. other move-. alloc , move- other.
:
move constructor. Constructs the container with the contents of other using move semantics. If alloc is not provided, allocator is obtained by move-construction from the allocator belonging to other.
Google.
. .
5)
init.
:
constructs the container with the contents of the initializer list init.
Google.
. .

alloc
:
allocator to use for all memory allocations of this container
Google.
. .
comp
first, last
:
the range to copy the elements from
Google.
. .
other
,
:
another container to be used as source to initialize the elements of the container with
Google.
. .
init
:
initializer list to initialize the elements of the container with
Google.
. .
-
InputIt InputIterator.

1)
:
constant
Google.
. .
2) N log(N), N = std::distance(first, last) , N value_comp().
3)
other
:
linear in size of other
Google.
. .
4)
. alloc alloc != other.get_allocator(), .
:
constant. If alloc is given and alloc != other.get_allocator(), then linear.
Google.
. .
5) N log(N), N = init.size()) , N init value_comp().

( (4)), , ( ) other , *this. [container.reqmts]/67, LWG 2321.

.


(public -) []

Web Proxy Viewer  |  New URL  |  Original Page