Andrey Semashev
c63d36cf5b
Added string_view::contains methods.
...
These methods were added in C++23.
Also updated string_view/ref tests:
- Added tests for string_view::contains.
- Added missing includes.
- Added missing std:: qualification.
- Removed tabs.
- Fixed misleading indentation (fixes gcc warnings).
- Fixed decrementing pointer before beginning of the string.
Closes https://github.com/boostorg/utility/issues/93 .
2022-05-04 00:32:30 +03:00
Andrey Semashev
0106ffda5f
Added string_view/ref::substr overloads taking no arguments.
...
This effectively adds support for pos=0 default argument value.
The separate overload is better as it avoids instantiating std::min,
boost::throw_exception and removes std::out_of_range construction, which
potentially reduces code size, while maintaining the same behavior.
Fixes https://github.com/boostorg/utility/issues/96 .
2022-05-03 00:46:03 +03:00
Andrey Semashev
0c1d01d30a
Removed noexcept from string_view::compare that may throw.
...
One overload of string_view::compare calls substr internally,
which may throw. This makes compare potentially throwing.
Fixes https://github.com/boostorg/utility/issues/94 .
2022-05-03 00:42:20 +03:00
Andrey Semashev
7ac95c156c
Fixed string_view/ref::max_size() returning incorrect value.
...
Fixes https://github.com/boostorg/utility/issues/91 .
2022-05-03 00:38:15 +03:00
Andrey Semashev
eb29d71245
Corrected argument type in string_view/ref::at().
2022-05-03 00:23:10 +03:00
Nikita Kniazev
6cca23a63a
Cease dependence on ContainerHash
...
by local `hash_range` forward declaration
2021-06-20 19:34:05 +03:00
Marshall Clow
9c2aa8d193
Revert "Make string_{view|ref} remove_prefix and remove_suffix throw on invalid lengths. Addresses issue #73 "
...
This reverts commit 601fc9371f
.
2021-03-01 16:50:14 -08:00
Marshall Clow
601fc9371f
Make string_{view|ref} remove_prefix and remove_suffix throw on invalid lengths. Addresses issue #73
2021-03-01 06:52:49 -08:00
Glen Fernandes
2b436d7d50
Use ostream_put from Boost.IO
2019-12-15 09:46:38 -05:00
Andrey Semashev
9eeb7f85c5
Replaced tabs with spaces.
2019-06-25 15:46:36 +03:00
Glen Fernandes
dabf53a703
Refactor stream write functionality into a standalone utility
2019-04-19 09:53:29 -04:00
Glen Fernandes
5fe9df91c0
Make string_view operator<< use rdbuf directly
2019-04-12 18:06:35 -04:00
Dimitrij Mijoski
e2d115db97
Use hash_fwd.hpp in string_view for more lightweight dependencies.
2018-04-20 23:18:31 +02:00
Dimitrij Mijoski
6ad6bc005c
Implement boost hash for string_view
2018-04-20 13:42:07 +02:00
Dimitrij Mijoski
eacea4664d
implement string_view.find(string) in terms of traits.compare and find.
...
This should be faster that it's previous implementations
in terms of std::search()
2018-04-02 00:52:57 +02:00
Dimitrij Mijoski
1fe5af5264
Faster find functions in string_view by using traits::find()
2018-04-01 20:00:03 +02:00
Marshall Clow
330b49d602
Mark comparison operators for string_view as constexpr; add tests. Reference: https://svn.boost.org/trac/boost/ticket/12896
2017-05-03 19:58:02 -07:00
Marshall Clow
68b26cddbe
Merge branch 'develop' of github.com:boostorg/utility into develop
2017-04-06 07:59:12 -07:00
Marshall Clow
6c4ab93573
Revert change disallowing construction of string_view/string_ref from rvalue string
2017-03-28 15:17:09 +02:00
Marshall Clow
0876da45db
Fix potential overflow in substr; Trac #11536 . Also change string_view::copy to use the traits::copy
2017-02-13 10:49:17 -08:00
Marshall Clow
00f02167e3
Add tests to ensure that string_view|ref from rvalue fails (whenever it can)
2017-02-13 10:25:04 -08:00
Marshall Clow
9960d9f395
Don't construct string_view|string_ref from rvalue string. That way lies pain
2017-02-13 08:15:44 -08:00
Surogate
38121f2af3
Allow string_view::at() to be constexpr again on VS2015
...
VS2015 doesn't support extended constexpr. Thanks to Lastique for the
ternary trick
2016-12-12 23:45:34 +01:00
Surogate
38b536ff05
Fixing visual studio compilation of string_view::at()
...
VS2013, VS2015 & VS2017RC don't like the ternary throwing an exception :
'return': cannot convert from 'void' to 'const char &'
Now using classic if when compiling on a windows platform.
2016-12-12 22:57:56 +01:00
zerotypos-found
816607e212
Remove tabs and Non-ASCII characters.
2016-11-15 11:59:51 +09:00
Andrey Semashev
21dc552cf9
Added a workaround for gcc 4.6 in C++11 mode as it can't seem to handle defaulted functions with noexcept specifier. The problem was discovered with autotests.
2016-09-02 19:14:00 +03:00
Andrey Semashev
4814d1ebfe
Added another overload of to_string when default function template arguments are not supported.
...
The additional overload more closely emulates the official interface and allows to construct strings with custom allocators.
2016-09-01 22:08:28 +03:00
gnaggnoyil
e5932ebb08
fix compile error on basic_string_view::to_string when Allocator is user-defined
2016-09-01 21:56:20 +03:00
Marshall Clow
8392991c46
Remove extraneous semicolon; no functional change
2016-08-14 11:19:32 -07:00
Marshall Clow
c5b1256650
rename routines in detail namespace so that someone who includes both <string_ref> and <string_view> won't get duplicate decls
2016-08-14 11:11:12 -07:00
Marshall Clow
c56dd13592
Mark the copy ctor/assignment operator as '= default' when the compiler supports it. This makes these types trivially copy/move assignable/constructible. See https://svn.boost.org/trac/boost/ticket/11684
2016-07-27 11:18:18 -07:00
Marshall Clow
1caa745dd7
Introduce new 'string_view' to match the one in the standard. Step #2 (up next) is to retire string_ref in favor of string_view
2015-12-21 11:39:59 -08:00