##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::char_traits::assign

From cppreference.com
< cpp‎ | string‎ | char traits

static void assign( char_type& r, const char_type& a ); | (1) |
static char_type* assign( char_type* p, std::size_t count, char_type a ); | (2) |

Assigns a character.

1) Assigns character `a` to character `r`.
2) Assigns character `a` to each character in `count` characters in the character sequence pointed to by `p`.

### [edit] Parameters

a | - | character value to assign
r | - | character to assign to
p | - | pointer to a character sequence to assign to
count | - | the length of the character sequence

### [edit] Return value

1) (none)
2) `p`

### [edit] Exceptions

1)

(none) | (until C++11)
`noexcept` specification: noexcept | (since C++11)

2) (none)

### [edit] Complexity

1) Constant.
2) Linear in `count`
Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/string/char_traits/assign&oldid=64879"