Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/string/basic string/append range"

From cppreference.com
< cpp‎ | string‎ | basic string
(+)
 
m (fmt)
Line 12: Line 12:
 
Equivalent to  
 
Equivalent to  
 
{{source|1=
 
{{source|1=
return append( std::basic_string( std::from_range, std​::​forward<R>(rg), get_allocator()) );
+
return append(std::basic_string( std::from_range, std​::​forward<R>(rg), get_allocator()));
 
}}
 
}}
  
 
===Parameters===
 
===Parameters===
 
{{par begin}}
 
{{par begin}}
{{par|rg|A [[cpp/ranges/to|''container-compatible-range'']].}}
+
{{par|rg|[[cpp/ranges/to|''container-compatible-range'']]}}
 
{{par end}}
 
{{par end}}
  

Revision as of 14:29, 9 June 2023

 
 
 
std::basic_string
 
template< container-compatible-range<CharT> R >
constexpr std::basic_string& append_range(R&& rg);
(1) (since C++23)

Appends all characters from the range rg.

Equivalent to

return append(std::basic_string( std::from_range, std​::​forward<R>(rg), get_allocator()));

Contents

Parameters

rg - a container-compatible-range

Return value

*this

Complexity

Linear in size of rg.

Exceptions

Throws std::length_error if the resultant string size would exceed max_size().

If an exception is thrown for any reason, this function has no effect (strong exception safety guarantee).

Example

See also

appends characters to the end
(public member function) [edit]