Sprout/source/libs/string/basic_string/clear.rst

37 lines
874 B
ReStructuredText
Raw Normal View History

2013-09-08 09:59:50 +00:00
.. _sprout-string-basic_string-clear:
###############################################################################
clear
###############################################################################
Interface
========================================
.. sourcecode:: c++
2013-11-04 05:31:03 +00:00
SPROUT_CXX14_CONSTEXPR void clear() SPROUT_NOEXCEPT;
2013-09-08 09:59:50 +00:00
Effects
========================================
| Fill [begin,end) with value_type(), and set the 0 to length.
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() {
x.clear();
SPROUT_ASSERT_MSG(x.size() == 0 && x == "", "string is cleared.");
}
2013-09-08 09:59:50 +00:00
Header
========================================
| ``sprout/string/string.hpp``
| Convenience header: ``sprout/string.hpp``