2013-09-05 04:09:04 +00:00
|
|
|
.. _sprout-string-char_traits-assign:
|
|
|
|
###############################################################################
|
|
|
|
assign
|
|
|
|
###############################################################################
|
|
|
|
|
|
|
|
Interface
|
|
|
|
========================================
|
|
|
|
.. sourcecode:: c++
|
|
|
|
|
2013-11-04 05:31:03 +00:00
|
|
|
static SPROUT_CXX14_CONSTEXPR void assign(char_type& c1, char_type const& c2);
|
2013-09-05 04:09:04 +00:00
|
|
|
|
|
|
|
Effects
|
|
|
|
========================================
|
|
|
|
|
|
|
|
| Equivalent to ``std::char_traits<Char>::assign(c1, c2)``.
|
|
|
|
|
|
|
|
Examples
|
|
|
|
========================================
|
|
|
|
.. sourcecode:: c++
|
|
|
|
|
|
|
|
#include <sprout/string.hpp>
|
|
|
|
#include <sprout/assert.hpp>
|
|
|
|
using namespace sprout;
|
|
|
|
|
|
|
|
char x = 'H';
|
|
|
|
SPROUT_STATIC_CONSTEXPR char y = 'M';
|
2013-09-13 08:22:10 +00:00
|
|
|
int main() {
|
|
|
|
char_traits<char>::assign(x, y);
|
|
|
|
SPROUT_ASSERT_MSG(x == y, "y is assigned to x.");
|
|
|
|
}
|
2013-09-05 04:09:04 +00:00
|
|
|
|
|
|
|
Complexity
|
|
|
|
========================================
|
|
|
|
|
|
|
|
| constant.
|
|
|
|
|
|
|
|
Header
|
|
|
|
========================================
|
|
|
|
|
|
|
|
| ``sprout/string/char_traits.hpp``
|
|
|
|
| Convenience header: ``sprout/string.hpp``
|
|
|
|
|