This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Refactor std::basic_string_view members and add noexcept


This applies 'noexcept' more liberally in our std::basic_string_view,
anywhere that can't actually throw (even if it has a narrow contract).

I've also refactored some members to remove complex conditional
expressions, because they're not needed with C++14 constexpr, we can
just write the code as normal.

	* include/bits/string_view.tcc (find_first_of, find_last_of)
	(find_first_not_of, find_last_not_of): Add noexcept.
	* include/std/string_view (basic_string_view(const _CharT*))
	(basic_string_view(const _CharT*, size_type))
	(front, back, remove_prefix, remove_suffix, find, rfind)
	(find_first_of, find_first_not_of): Add noexcept.
	(at(size_type), _S_compare(size_type, size_type)): Replace conditional
	expressions with if statements.
	(copy(_CharT*, size_type, size_type), substr(size_type, size_type)):
	Use _M_check for length checks.
	(compare(basic_string_view)): Reformat.
	(_M_check(size_type, const char)): Add noexcept(false).
	(_M_limit(size_type, size_type)): Use noexcept not _GLIBCXX_NOEXCEPT.

Tested powerpc64le-linux, committed to trunk.

Attachment: patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]