399 Commits

Author SHA1 Message Date
Andrey Semashev
f3963f5375 Attempt to work around C++20 operator rewriting causinginfinite recursion.
Fixes https://github.com/boostorg/utility/issues/65.
2020-11-30 01:52:44 +03:00
Peter Dimov
8faf831bd1 memset data_ instead of *this 2020-05-25 23:50:35 +03:00
Peter Dimov
25cb7aa122 Use a base class to apply the memset workaround to avoid dependency on TypeTraits 2020-05-25 05:09:36 +03:00
Glen Fernandes
64fffa0f97 Simplify BOOST_OPERATORS_CONSTEXPR definition 2020-04-12 13:03:30 -04:00
Glen Fernandes
5da340a2a4 Rename BOOST_OPS_CONSTEXPR to BOOST_OPERATORS_CONSTEXPR 2020-04-12 13:03:22 -04:00
Marshall Clow
0c059a50ad
Merge pull request #63 from eldiener/develop
Changes for Embarcadero C++ clang-based compilers, targeting Boost 1.74. Change __BORLANDC__ to BOOST_BORLANDC, which is defined in Boost conf…
2020-04-12 09:49:06 -07:00
Daniel Frey
bdc5b5cf3a
Merge pull request #55 from tonyelewis/add-constexpr-support
Add constexpr to operators (w/ basic docs, tests)
2020-04-12 13:07:24 +02:00
Tony Lewis
46f72656b3 Remove constexpr from all but the comparison ops 2020-04-11 18:31:15 +01:00
Tony Lewis
e3a2a06011 Re-add constexpr support for newer MSVC versions 2020-04-11 18:30:24 +01:00
Edward Diener
a4752e066d Change __BORLANDC__ to BOOST_BORLANDC, which is defined in Boost config for the Embarcadero non-clang-based compilers. 2020-03-24 01:39:51 -04: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
Tony Lewis
6b62dcc504 Completely remove constexpr for MSVC 2018-12-24 07:02:31 +00:00
Tony Lewis
91ebdcd1dd Remove C++14 constexpr due to MSVC/GCC problems 2018-12-22 15:52:13 +00:00
Tony Lewis
e8d2b2ba76 Add constexpr to operators (w/ basic docs, tests) 2018-12-21 10:28:22 +00:00
Marshall Clow
db05c11f50 Fix string_ref::find/rfind's handling of empty strings. Thanks to 'reluctantbugreporter' for the bug report 2018-09-14 09:48:13 -07:00
Glen Fernandes
fc135e0d72 Avoid inheritance for final types in compressed_pair 2018-09-09 17:34:22 -04:00
Peter Dimov
bdf55e0b6f Add boilerplate reference to LICENSE_1_0.txt 2018-07-31 00:22:42 +03: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
Peter Dimov
c88936800d Remove dependency on Random in operators_test.cpp 2017-12-23 06:19:43 +02:00
Peter Dimov
9d46de1578 Replace use of mpl/has_xxx.hpp with handwritten traits 2017-12-21 06:30:03 +02:00
Peter Dimov
7d101d420c Replace mpl primitives with type_traits 2017-12-20 21:55:07 +02:00
Peter Dimov
d8acfef27b Update includes in utility.hpp; add deprecation comment 2017-12-02 04:35:22 +02:00
Peter Dimov
b74f49f1e5 Remove dependency on iterator in <boost/utility.hpp> 2017-12-02 03:38:29 +02:00
Daniel Frey
ad0fc7c9d3
Protect dereferenceable<> against overloaded operator&, fixes #35 2017-11-23 21:14:07 +01:00
Daniel Frey
2f5a6fbcf1 Adapt to C++17, fixes #34 2017-10-15 10:34:04 +02:00
morinmorin
fb2f110eb4 Fix result_of_is_callable to support references to function pointers.
On compilers without the support of expression SFINAE, decltype-based
result_of<FP&(...)> failed to compile (FP is a function pointer type).
2017-09-20 23:40:56 +09:00
Andrey Semashev
62b39548be Moved next/prior to Boost.Iterator. 2017-08-26 17:25:14 +03:00
Andrey Semashev
2722fdcda3 Use std::iterator_traits to detect iterators, when possible.
This allows next/prior to detect user's iterators that do not
define iterator_category nested type but specialize
std::iterator_traits instead.
2017-07-23 20:29:25 +03:00
Andrey Semashev
e25d85446e Use Boost.Iterator to advance iterators.
By using Boost.Iterator we rely on the separate traversal category instead of
the standard iterator category to advance iterators efficiently. For instance,
this allows to advance transform iterators over a random access sequence
in constant time, despite that they are formally input iterators.

Also, std::reverse_iterator formally requires at least bidirectional iterator
as the underlying iterator type. Transform iterators from the example above
don't qualify, so potentially std::reverse_iterator could fail to compile.
2017-07-12 21:15:20 +03:00
Andrey Semashev
5bc9e47688 Changed iterator_category nested type detection to work with MSVC and different versions of gcc. 2017-07-12 20:14:48 +03:00
Andrey Semashev
6cf9c22cf1 Reworked iterator handling in next/prior helpers.
The new implementation tries to detect if the incremented/decremented type
is an iterator first and if not falls back to operator probing. This way
iterators that are not SFINAE-friendly (i.e. unconditionally define
arithmetic operators regardless of the iterator category) are still treated
as iterators through std::advance and do not fail the compilation.

The iterator detection is based on probing for the nested iterator_category
type that is expected to be present in class-type iterators. This heuristic
is not flawless since iterators are not required to defined this type.
User-defined iterators may not have it and instead specialize
std::iterator_traits. This use case is not covered by the current implementation
and will likely fail to compile. With C++17 SFINAE-friendly std::iterator_traits
this can be fixed, but currently Boost.Config lacks the macro to detect
availability of this feature. Support for it can be added by a later commit.

Also simplified boost::prior for iterators, removing the possibility of
integer overflow caused by negation of the distance value.
2017-07-09 03:10:01 +03:00
Peter Dimov
21261a8630 Add visible dependency to result_of_iterate.hpp 2017-05-30 01:20:02 +03: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
Marcel Raad
c5c479d49c Use non-deprecated include paths
According to the comments in these two headers, the files in the core directory should be used instead.
2016-12-21 08:22:35 +01: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
Peter Dimov
ff445c0ece Remove std::binary_function use, it has been removed in C++17 2016-11-06 14:38:13 +02: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