2013-09-05 08:16:56 +00:00
|
|
|
.. _sprout-string-char_traits-assign-iterator:
|
|
|
|
###############################################################################
|
|
|
|
assign
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
Interface
|
|
|
|
========================================
|
|
|
|
.. sourcecode:: c++
|
|
|
|
|
|
|
|
template<typename OutputIterator>
|
2013-11-04 05:31:03 +00:00
|
|
|
static SPROUT_CXX14_CONSTEXPR OutputIterator assign(OutputIterator s, std::size_t n, char_type a);
|
2013-09-05 08:16:56 +00:00
|
|
|
|
|
|
|
Effects
|
|
|
|
========================================
|
|
|
|
|
|
|
|
| For each i in [0,n) performs ``assign(s[i], c)``.
|
|
|
|
|
|
|
|
Examples
|
|
|
|
========================================
|
|
|
|
.. sourcecode:: c++
|
|
|
|
|
|
|
|
#include <sprout/string.hpp>
|
|
|
|
#include <sprout/assert.hpp>
|
|
|
|
using namespace sprout;
|
|
|
|
|
|
|
|
auto x = string<8>("homuhomu");;
|
2013-09-13 08:22:10 +00:00
|
|
|
int main() {
|
|
|
|
char_traits<char>::assign(x.begin(), 8, 'M');
|
|
|
|
SPROUT_ASSERT_MSG(x[0] == 'M', "x is filled by M.");
|
|
|
|
}
|
2013-09-05 08:16:56 +00:00
|
|
|
|
|
|
|
Complexity
|
|
|
|
========================================
|
|
|
|
|
|
|
|
| linear.
|
|
|
|
|
|
|
|
Header
|
|
|
|
========================================
|
|
|
|
|
|
|
|
| ``sprout/string/char_traits.hpp``
|
|
|
|
| Convenience header: ``sprout/string.hpp``
|
|
|
|
|