Table Of Contents

Previous topic

copy

Next topic

basic_string

This Page

assign

Interface

template<typename OutputIterator>
static SPROUT_CXX14_CONSTEXPR OutputIterator assign(OutputIterator s, std::size_t n, char_type a);

Effects

For each i in [0,n) performs assign(s[i], c).

Examples

#include <sprout/string.hpp>
#include <sprout/assert.hpp>
using namespace sprout;

auto x = string<8>("homuhomu");;
int main() {
  char_traits<char>::assign(x.begin(), 8, 'M');
  SPROUT_ASSERT_MSG(x[0] == 'M', "x is filled by M.");
}

Complexity

linear.