From 73baeb7a63e132187d3020fc704aaf210e128623 Mon Sep 17 00:00:00 2001
From: Daniel James
Date: Thu, 11 Jan 2018 18:01:50 +0000
Subject: [PATCH 1/9] Fix some links
---
doc/base_from_member.qbk | 2 +-
operators.htm | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/doc/base_from_member.qbk b/doc/base_from_member.qbk
index 9afd949..9801214 100644
--- a/doc/base_from_member.qbk
+++ b/doc/base_from_member.qbk
@@ -356,7 +356,7 @@ templates that can be controlled and automated with macros. The
implementation uses the [@../../../preprocessor/index.html Preprocessor library].
* [@http://www.boost.org/people/daryle_walker.html">Daryle Walker] started the
-library. Contributed the test file [@../../base_from_member_test.cpp
+library. Contributed the test file [@../../test/base_from_member_test.cpp
base_from_member_test.cpp].
[endsect]
diff --git a/operators.htm b/operators.htm
index 993436c..db81fd3 100644
--- a/operators.htm
+++ b/operators.htm
@@ -1586,7 +1586,7 @@ T operator+( T lhs, const T& rhs )
- The operators_test.cpp
+
The operators_test.cpp
program demonstrates the use of the arithmetic operator templates, and
can also be used to verify correct operation. Check the compiler status
report for the test results with selected platforms.
@@ -1998,7 +1998,7 @@ struct function_output_iterator
- The iterators_test.cpp
+
The iterators_test.cpp
program demonstrates the use of the iterator templates, and can also be
used to verify correct operation. The following is the custom iterator
defined in the test program. It demonstrates a correct (though trivial)
@@ -2064,7 +2064,7 @@ public:
Beman Dawes
Contributed operators_test.cpp.
+ "test/operators_test.cpp">operators_test.cpp.
Daryle Walker
From d2fb06e6a0682a5fd0f0554316f50fb5adc6b55e Mon Sep 17 00:00:00 2001
From: Daniel James
Date: Fri, 12 Jan 2018 10:48:52 +0000
Subject: [PATCH 2/9] Fix another link
---
call_traits.htm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/call_traits.htm b/call_traits.htm
index a69c1de..b4fe3ee 100644
--- a/call_traits.htm
+++ b/call_traits.htm
@@ -493,7 +493,7 @@ call_traits can not be used with reference or array types.
Example 1:
The following class is a trivial class that stores some type T
-by value (see the call_traits_test.cpp
+by value (see the call_traits_test.cpp
file), the aim is to illustrate how each of the available
call_traits typedefs may be used:
From 6ad6bc005c33dbf677c2a413ff435b7219edbc4e Mon Sep 17 00:00:00 2001
From: Dimitrij Mijoski
Date: Fri, 20 Apr 2018 13:42:07 +0200
Subject: [PATCH 3/9] Implement boost hash for string_view
---
.travis.yml | 1 +
appveyor.yml | 1 +
include/boost/utility/string_view.hpp | 5 +++++
test/string_view_test1.cpp | 9 +++++++++
4 files changed, 16 insertions(+)
diff --git a/.travis.yml b/.travis.yml
index ab048db..7448bf9 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -192,6 +192,7 @@ install:
- git submodule update --init libs/static_assert
- git submodule update --init libs/throw_exception
- git submodule update --init libs/type_traits
+ - git submodule update --init libs/container_hash
- cp -r $TRAVIS_BUILD_DIR/* libs/utility
- ./bootstrap.sh
- ./b2 headers
diff --git a/appveyor.yml b/appveyor.yml
index 77623f0..cb0cf9f 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -36,6 +36,7 @@ install:
- git submodule update --init libs/static_assert
- git submodule update --init libs/throw_exception
- git submodule update --init libs/type_traits
+ - git submodule update --init libs/container_hash
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\utility
- cmd /c bootstrap
- b2 -d0 headers
diff --git a/include/boost/utility/string_view.hpp b/include/boost/utility/string_view.hpp
index 44efda9..0faa8f0 100644
--- a/include/boost/utility/string_view.hpp
+++ b/include/boost/utility/string_view.hpp
@@ -21,6 +21,7 @@
#include
#include
#include
+#include
#include
#include
@@ -690,6 +691,10 @@ namespace boost {
}
#endif
+ template
+ std::size_t hash_value(basic_string_view s) {
+ return boost::hash_range(s.begin(), s.end());
+ }
}
#if 0
diff --git a/test/string_view_test1.cpp b/test/string_view_test1.cpp
index 9b70a7e..90aec4e 100644
--- a/test/string_view_test1.cpp
+++ b/test/string_view_test1.cpp
@@ -85,6 +85,14 @@ void test_remove ( const std::string &str ) {
}
}
+void test_hash(const std::string& str) {
+ string_view ref = str;
+ BOOST_TEST(boost::hash_value(ref) == boost::hash_value(str));
+ boost::hash hstr;
+ boost::hash hsv;
+ BOOST_TEST(hsv(ref) == hstr(str));
+ }
+
const char *test_strings [] = {
"",
"1",
@@ -102,6 +110,7 @@ int main()
test_substr ( *p );
test_remove ( *p );
null_tests ( *p );
+ test_hash( *p );
p++;
}
From 473be2e4c1987976d3e00617fa0caa24ca67f554 Mon Sep 17 00:00:00 2001
From: Dimitrij Mijoski
Date: Fri, 20 Apr 2018 13:58:12 +0200
Subject: [PATCH 4/9] Boost integer is dependency of boost hash.
---
.travis.yml | 1 +
appveyor.yml | 1 +
2 files changed, 2 insertions(+)
diff --git a/.travis.yml b/.travis.yml
index 7448bf9..1c6dbdb 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -193,6 +193,7 @@ install:
- git submodule update --init libs/throw_exception
- git submodule update --init libs/type_traits
- git submodule update --init libs/container_hash
+ - git submodule update --init libs/integer
- cp -r $TRAVIS_BUILD_DIR/* libs/utility
- ./bootstrap.sh
- ./b2 headers
diff --git a/appveyor.yml b/appveyor.yml
index cb0cf9f..c81a2ac 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -37,6 +37,7 @@ install:
- git submodule update --init libs/throw_exception
- git submodule update --init libs/type_traits
- git submodule update --init libs/container_hash
+ - git submodule update --init libs/integer
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\utility
- cmd /c bootstrap
- b2 -d0 headers
From 15cfa44937f5243f1b9d97d2ee4ad6979a42c1d3 Mon Sep 17 00:00:00 2001
From: Dimitrij Mijoski
Date: Fri, 20 Apr 2018 14:07:33 +0200
Subject: [PATCH 5/9] Boost detail is dependency of boost hash.
---
.travis.yml | 1 +
appveyor.yml | 1 +
2 files changed, 2 insertions(+)
diff --git a/.travis.yml b/.travis.yml
index 1c6dbdb..1e0f8fa 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -194,6 +194,7 @@ install:
- git submodule update --init libs/type_traits
- git submodule update --init libs/container_hash
- git submodule update --init libs/integer
+ - git submodule update --init libs/detail
- cp -r $TRAVIS_BUILD_DIR/* libs/utility
- ./bootstrap.sh
- ./b2 headers
diff --git a/appveyor.yml b/appveyor.yml
index c81a2ac..b63ff9f 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -38,6 +38,7 @@ install:
- git submodule update --init libs/type_traits
- git submodule update --init libs/container_hash
- git submodule update --init libs/integer
+ - git submodule update --init libs/detail
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\utility
- cmd /c bootstrap
- b2 -d0 headers
From e2d115db9772ee294d94d8970bea0189de70a81f Mon Sep 17 00:00:00 2001
From: Dimitrij Mijoski
Date: Fri, 20 Apr 2018 23:18:31 +0200
Subject: [PATCH 6/9] Use hash_fwd.hpp in string_view for more lightweight
dependencies.
---
include/boost/utility/string_view.hpp | 2 +-
test/string_view_test1.cpp | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/boost/utility/string_view.hpp b/include/boost/utility/string_view.hpp
index 0faa8f0..11aa801 100644
--- a/include/boost/utility/string_view.hpp
+++ b/include/boost/utility/string_view.hpp
@@ -21,7 +21,7 @@
#include
#include
#include
-#include
+#include
#include
#include
diff --git a/test/string_view_test1.cpp b/test/string_view_test1.cpp
index 90aec4e..c35bbfa 100644
--- a/test/string_view_test1.cpp
+++ b/test/string_view_test1.cpp
@@ -12,6 +12,7 @@
#include
#include
+#include
#include
From bdf55e0b6f52f5d4bf40c381fbb8ae7060510c15 Mon Sep 17 00:00:00 2001
From: Peter Dimov
Date: Tue, 31 Jul 2018 00:22:42 +0300
Subject: [PATCH 7/9] Add boilerplate reference to LICENSE_1_0.txt
---
include/boost/utility/detail/minstd_rand.hpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/boost/utility/detail/minstd_rand.hpp b/include/boost/utility/detail/minstd_rand.hpp
index 6c858f6..95efb21 100644
--- a/include/boost/utility/detail/minstd_rand.hpp
+++ b/include/boost/utility/detail/minstd_rand.hpp
@@ -5,6 +5,9 @@
//
// Distributed under the Boost Software License, Version 1.0.
//
+// See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt
+//
// An implementation of minstd_rand that does not require
// the Random library
From fc135e0d72610e13c6dac0aa11e09f710526f022 Mon Sep 17 00:00:00 2001
From: Glen Fernandes
Date: Sun, 9 Sep 2018 15:00:49 -0400
Subject: [PATCH 8/9] Avoid inheritance for final types in compressed_pair
---
include/boost/detail/compressed_pair.hpp | 25 +++++++----
test/Jamfile.v2 | 1 +
test/compressed_pair_final_test.cpp | 55 ++++++++++++++++++++++++
3 files changed, 73 insertions(+), 8 deletions(-)
create mode 100644 test/compressed_pair_final_test.cpp
diff --git a/include/boost/detail/compressed_pair.hpp b/include/boost/detail/compressed_pair.hpp
index 5dc21e2..b090a72 100644
--- a/include/boost/detail/compressed_pair.hpp
+++ b/include/boost/detail/compressed_pair.hpp
@@ -24,6 +24,7 @@
#include
#include
+#include
#include
#include
@@ -42,6 +43,14 @@ class compressed_pair;
namespace details
{
+ template::value>
+ struct compressed_pair_empty
+ : ::boost::false_type { };
+
+ template
+ struct compressed_pair_empty
+ : ::boost::is_empty { };
+
// JM altered 26 Jan 2000:
template
struct compressed_pair_switch;
@@ -343,8 +352,8 @@ class compressed_pair
T1,
T2,
::boost::is_same::type, typename remove_cv::type>::value,
- ::boost::is_empty::value,
- ::boost::is_empty::value>::value>
+ ::boost::details::compressed_pair_empty::value,
+ ::boost::details::compressed_pair_empty::value>::value>
{
private:
typedef details::compressed_pair_imp::type, typename remove_cv::type>::value,
- ::boost::is_empty::value,
- ::boost::is_empty::value>::value> base;
+ ::boost::details::compressed_pair_empty::value,
+ ::boost::details::compressed_pair_empty::value>::value> base;
public:
typedef T1 first_type;
typedef T2 second_type;
@@ -388,8 +397,8 @@ class compressed_pair
T,
T,
::boost::is_same::type, typename remove_cv::type>::value,
- ::boost::is_empty::value,
- ::boost::is_empty::value>::value>
+ ::boost::details::compressed_pair_empty::value,
+ ::boost::details::compressed_pair_empty::value>::value>
{
private:
typedef details::compressed_pair_imp::type, typename remove_cv::type>::value,
- ::boost::is_empty::value,
- ::boost::is_empty::value>::value> base;
+ ::boost::details::compressed_pair_empty::value,
+ ::boost::details::compressed_pair_empty::value>::value> base;
public:
typedef T first_type;
typedef T second_type;
diff --git a/test/Jamfile.v2 b/test/Jamfile.v2
index 7fd5b2f..739edc0 100644
--- a/test/Jamfile.v2
+++ b/test/Jamfile.v2
@@ -16,6 +16,7 @@ run binary_test.cpp ;
run call_traits_test.cpp : -u ;
run compressed_pair_test.cpp ;
+run compressed_pair_final_test.cpp ;
run iterators_test.cpp ;
diff --git a/test/compressed_pair_final_test.cpp b/test/compressed_pair_final_test.cpp
new file mode 100644
index 0000000..247f3fc
--- /dev/null
+++ b/test/compressed_pair_final_test.cpp
@@ -0,0 +1,55 @@
+/*
+Copyright 2018 Glen Joseph Fernandes
+(glenjofe@gmail.com)
+
+Distributed under the Boost Software License, Version 1.0.
+(http://www.boost.org/LICENSE_1_0.txt)
+*/
+#include
+#if !defined(BOOST_NO_CXX11_FINAL)
+#include
+#include
+
+struct type1 {
+ operator bool() const {
+ return false;
+ }
+};
+
+struct type2 final {
+ operator bool() const {
+ return false;
+ }
+};
+
+#if !defined(BOOST_IS_FINAL)
+namespace boost {
+
+template<>
+struct is_final
+ : true_type { };
+
+} /* boost*/
+#endif
+
+template
+void test()
+{
+ boost::compressed_pair p;
+ BOOST_TEST(!p.first());
+ BOOST_TEST(!p.second());
+}
+
+int main()
+{
+ test();
+ test();
+ test();
+ return boost::report_errors();
+}
+#else
+int main()
+{
+ return 0;
+}
+#endif
From db05c11f50558c2da132dc6ed53b8ec4ab1b1471 Mon Sep 17 00:00:00 2001
From: Marshall Clow
Date: Fri, 14 Sep 2018 09:48:13 -0700
Subject: [PATCH 9/9] Fix string_ref::find/rfind's handling of empty strings.
Thanks to 'reluctantbugreporter' for the bug report
---
include/boost/utility/string_ref.hpp | 2 ++
test/string_ref_test2.cpp | 4 ++++
test/string_view_test2.cpp | 4 ++++
3 files changed, 10 insertions(+)
diff --git a/include/boost/utility/string_ref.hpp b/include/boost/utility/string_ref.hpp
index d234e54..4b36ffc 100644
--- a/include/boost/utility/string_ref.hpp
+++ b/include/boost/utility/string_ref.hpp
@@ -181,6 +181,7 @@ namespace boost {
}
size_type find(basic_string_ref s) const {
+ if (s.empty()) return 0;
const_iterator iter = std::search ( this->cbegin (), this->cend (),
s.cbegin (), s.cend (), traits::eq );
return iter == this->cend () ? npos : std::distance ( this->cbegin (), iter );
@@ -193,6 +194,7 @@ namespace boost {
}
size_type rfind(basic_string_ref s) const {
+ if (s.empty()) return 0;
const_reverse_iterator iter = std::search ( this->crbegin (), this->crend (),
s.crbegin (), s.crend (), traits::eq );
return iter == this->crend () ? npos : (std::distance(iter, this->crend()) - s.size());
diff --git a/test/string_ref_test2.cpp b/test/string_ref_test2.cpp
index ccb5d6d..d733775 100644
--- a/test/string_ref_test2.cpp
+++ b/test/string_ref_test2.cpp
@@ -93,6 +93,10 @@ void find ( const char *arg ) {
string_ref sr2;
const char *p;
+// When we search for the empty string, we find it at position 0
+ BOOST_TEST ( sr1.find (sr2) == 0 );
+ BOOST_TEST ( sr1.rfind(sr2) == 0 );
+
// Look for each character in the string(searching from the start)
p = arg;
sr1 = arg;
diff --git a/test/string_view_test2.cpp b/test/string_view_test2.cpp
index 2549e64..135fd1a 100644
--- a/test/string_view_test2.cpp
+++ b/test/string_view_test2.cpp
@@ -97,6 +97,10 @@ void find ( const char *arg ) {
string_view sr2;
const char *p;
+// When we search for the empty string, we find it at position 0
+ BOOST_TEST ( sr1.find (sr2) == 0 );
+ BOOST_TEST ( sr1.rfind(sr2) == 0 );
+
// Look for each character in the string(searching from the start)
p = arg;
sr1 = arg;