Sprout/source/libs/string/basic_string/operator-assign.rst

66 lines
1.5 KiB
ReStructuredText
Raw Normal View History

2013-09-08 10:28:17 +00:00
.. _sprout-string-basic_string-operator-assign:
###############################################################################
operator=
###############################################################################
Interface
========================================
.. sourcecode:: c++
2013-11-04 05:31:03 +00:00
SPROUT_CXX14_CONSTEXPR basic_string& operator=(basic_string const& rhs);
2013-09-08 10:28:17 +00:00
template<std::size_t N2, typename Enable = typename std::enable_if<(N2 != N)>::type>
2013-11-04 05:31:03 +00:00
SPROUT_CXX14_CONSTEXPR basic_string& operator=(basic_string<T, N2, Traits> const& rhs);
2013-09-08 10:28:17 +00:00
2013-11-04 05:31:03 +00:00
SPROUT_CXX14_CONSTEXPR basic_string& operator=(value_type const* rhs);
2013-09-08 10:28:17 +00:00
Effects
========================================
| Equivalent to ``assign(rhs)``.
Returns
========================================
| ``*this``.
Examples
========================================
.. sourcecode:: c++
#include <sprout/array.hpp>
#include <sprout/assert.hpp>
using namespace sprout;
auto x = string<8>("homuhomu");
SPROUT_STATIC_CONSTEXPR auto y = string<8>("madocchi");
2013-09-13 08:22:10 +00:00
int main() {
x = y;
SPROUT_ASSERT_MSG(x == y, "y is assigned to x.");
}
2013-09-08 10:28:17 +00:00
----
Interface
========================================
.. sourcecode:: c++
basic_string& operator=(value_type rhs);
Effects
========================================
| Equivalent to ``assign(1, rhs)``.
Returns
========================================
| ``*this``.
Header
========================================
| ``sprout/string/string.hpp``
| Convenience header: ``sprout/string.hpp``