public static member function
static void assign (char_type& r, const char_type& c);
static char_type* assign (char_type* p, size_t n, char_type c);
static void assign (char_type& r, const char_type& c) noexcept;
static char_type* assign (char_type* p, site_t n, char_type c);
Assigns c to a character (r) or to an array of characters (s).
- (1) character
- Assigns c to r, as if using r=c.
- (2) array
- Assigns c to the first n characters in the array pointed by s, each as if using operator=.
In the standard specializations of char_traits
, this function behaves as the built-in operator=
, but custom character traits
classes may provide an alternative behavior whenever this is consistent with the assignment operation of its character type.
- An lvalue reference to character.
- A character value.
- A pointer to the array where the characters will be written.
- Number of characters to fill with a value of c.
Member type char_type is the character type (i.e., the class template parameter in char_traits).
size_t is an unsigned integral type.
none (for (1)).
p (for (2)).
Unless s does not point to an array long enough, this member function never throws exceptions (no-throw guarantee) in any of the standard specializations.
Otherwise, it causes undefined behavior.
- Compare characters for equality ( public static member function