Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/utility/tuple/operator="

From cppreference.com
< cpp‎ | utility‎ | tuple
(Undo revision 44918 by Cubbi (talk) oops)
m (Shorten template names. Use {{lc}} where appropriate.)
Line 1: Line 1:
 
{{cpp/utility/tuple/title | operator{{=}}}}
 
{{cpp/utility/tuple/title | operator{{=}}}}
 
{{cpp/utility/tuple/navbar}}
 
{{cpp/utility/tuple/navbar}}
{{ddcl list begin}}
+
{{dcl begin}}
{{ddcl list item | num=1 | notes={{mark since c++11}} | 1=
+
{{dcl | num=1 | notes={{mark since c++11}} | 1=
 
tuple& operator=( const tuple& other );
 
tuple& operator=( const tuple& other );
 
}}
 
}}
{{ddcl list item | num=2 | notes={{mark since c++11}} | 1=
+
{{dcl | num=2 | notes={{mark since c++11}} | 1=
 
tuple& operator=( tuple&& other );
 
tuple& operator=( tuple&& other );
 
}}
 
}}
{{ddcl list item | num=3 | notes={{mark since c++11}} | 1=
+
{{dcl | num=3 | notes={{mark since c++11}} | 1=
 
template< class... UTypes >
 
template< class... UTypes >
 
tuple& operator=( const tuple<UTypes...>& other );
 
tuple& operator=( const tuple<UTypes...>& other );
 
}}
 
}}
{{ddcl list item | num=4 | notes={{mark since c++11}} | 1=
+
{{dcl | num=4 | notes={{mark since c++11}} | 1=
 
template< class... UTypes >
 
template< class... UTypes >
 
tuple& operator=( tuple<UTypes...>&& other );
 
tuple& operator=( tuple<UTypes...>&& other );
 
}}
 
}}
{{ddcl list item | num=5 | notes={{mark since c++11}} | 1=
+
{{dcl | num=5 | notes={{mark since c++11}} | 1=
 
template< class U1, class U2 >
 
template< class U1, class U2 >
 
tuple& operator=( const pair<U1,U2>& p );
 
tuple& operator=( const pair<U1,U2>& p );
 
}}
 
}}
{{ddcl list item | num=6 | notes={{mark since c++11}} | 1=
+
{{dcl | num=6 | notes={{mark since c++11}} | 1=
 
template< class U1, class U2 >
 
template< class U1, class U2 >
 
tuple& operator=( pair<U1,U2>&& p );
 
tuple& operator=( pair<U1,U2>&& p );
 
}}
 
}}
{{ddcl list end}}
+
{{dcl end}}
  
 
Replaces the contents of the tuple with the contents of another tuple or a pair.
 
Replaces the contents of the tuple with the contents of another tuple or a pair.
Line 41: Line 41:
  
 
===Parameters===
 
===Parameters===
{{param list begin}}
+
{{par begin}}
{{param list item | other | tuple to replace the contents of this tuple }}
+
{{par | other | tuple to replace the contents of this tuple }}
{{param list item | p | pair to replace the contents of this 2-tuple }}
+
{{par | p | pair to replace the contents of this 2-tuple }}
{{param list end}}  
+
{{par end}}  
  
 
===Return value===
 
===Return value===
Line 71: Line 71:
 
===See also===
 
===See also===
  
{{dcl list begin}}
+
{{dsc begin}}
{{dcl list end}}
+
{{dsc end}}
  
 
[[de:cpp/utility/tuple/operator=]]
 
[[de:cpp/utility/tuple/operator=]]

Revision as of 20:18, 31 May 2013

 
 
Utilities library
General utilities
Relational operators (deprecated in C++20)
 
 
tuple& operator=( const tuple& other );
(1) (since C++11)
tuple& operator=( tuple&& other );
(2) (since C++11)
template< class... UTypes >
tuple& operator=( const tuple<UTypes...>& other );
(3) (since C++11)
template< class... UTypes >
tuple& operator=( tuple<UTypes...>&& other );
(4) (since C++11)
template< class U1, class U2 >
tuple& operator=( const pair<U1,U2>& p );
(5) (since C++11)
template< class U1, class U2 >
tuple& operator=( pair<U1,U2>&& p );
(6) (since C++11)

Replaces the contents of the tuple with the contents of another tuple or a pair.

1) Copy assignment operator. Replaces each element with a copy of the corresponding element of other.

2) Move assignment operator. Replaces each element with the corresponding element of other using move semantics.

3) For all i, assigns std::get<i>(other) to std::get<i>(*this).

4) For all i, assigns std::forward<Ui>(std::get<i>(other)) to std::get<i>(*this).

5) Assigns p.first to the first element of *this and p.second to the second element of *this.

6) Assigns std::forward<U1>(p.first) to the first element of *this and std::forward<U2>(p.second) to the second element of *this.

Contents

Parameters

other - tuple to replace the contents of this tuple
p - pair to replace the contents of this 2-tuple

Return value

*this

Exceptions

1) (none)

2)
noexcept specification:  
noexcept(

    is_nothrow_move_assignable<T0>::value &&
    is_nothrow_move_assignable<T1>::value &&
    is_nothrow_move_assignable<T2>::value &&
    ...

)

3-5) (none)

6)
noexcept specification:  
noexcept
  

Example

See also