1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2024-11-12 21:09:01 +00:00
Sprout/source/libs/string/char_traits/assign-string.rst

42 lines
991 B
ReStructuredText
Raw Normal View History

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