Compare commits

..

5 Commits

Author SHA1 Message Date
Peter Dimov f017dac435 Enable failing tests 2025-01-26 21:26:46 +02:00
Peter Dimov 567ba40840 Add a dummy element to array<T, 0> to enable initialization with = {{}} 2025-01-26 21:15:39 +02:00
Peter Dimov 29700ff270 Update revision history 2025-01-26 21:02:26 +02:00
Peter Dimov b147799665 Remove local hash_value overload; boost::hash supports array-like types natively. 2025-01-26 20:35:19 +02:00
Peter Dimov acef60446a Update revision history 2025-01-26 20:31:53 +02:00
8 changed files with 17 additions and 19 deletions
+3
View File
@@ -16,3 +16,6 @@ http://www.boost.org/LICENSE_1_0.txt
* Added `noexcept` and `constexpr` as appropriate.
* Marked obsolete functions as deprecated.
* Removed obsolete compiler workarounds.
* Changed `array<T, 0>::begin()`, `cbegin()`, `end()`, `cend()` to return `nullptr`, enabling `constexpr`.
This matches the behavior of `std::array`.
* Removed local `hash_value` overload; `boost::hash` supports array-like types natively.
+2 -8
View File
@@ -195,6 +195,8 @@ namespace boost {
template< class T >
class array< T, 0 > {
public:
struct {} elems; // enables initialization with = {{}}
public:
// type definitions
@@ -395,14 +397,6 @@ namespace boost {
return arg.elems;
}
template <class It> std::size_t hash_range(It, It);
template<class T, std::size_t N>
std::size_t hash_value(const array<T,N>& arr)
{
return boost::hash_range(arr.begin(), arr.end());
}
template <size_t Idx, typename T, size_t N>
BOOST_CXX14_CONSTEXPR T &get(boost::array<T,N> &arr) BOOST_NOEXCEPT {
BOOST_STATIC_ASSERT_MSG ( Idx < N, "boost::get<>(boost::array &) index out of range" );
+2 -2
View File
@@ -44,11 +44,11 @@ template<class T> void test4()
int main()
{
// test1<int, 0>();
test1<int, 0>();
test1<int, 1>();
test1<int, 7>();
// test1<int const, 0>();
test1<int const, 0>();
test1<int const, 1>();
test1<int const, 7>();
+2 -2
View File
@@ -46,11 +46,11 @@ template<class T> void test4()
int main()
{
// test1<int, 0>();
test1<int, 0>();
test1<int, 1>();
test1<int, 7>();
// test1<int const, 0>();
test1<int const, 0>();
test1<int const, 1>();
test1<int const, 7>();
+2 -1
View File
@@ -56,7 +56,8 @@ template<class T> void test4()
template<class T> void test5()
{
// constexpr boost::array<T, 0> a = {{}};
constexpr boost::array<T, 0> a = {{}};
(void)a;
}
template<class T> void test6()
+2 -2
View File
@@ -94,11 +94,11 @@ template<class T> void test2()
int main()
{
// test<int, 0>();
test<int, 0>();
test<int, 1>();
test<int, 7>();
// test<int const, 0>();
test<int const, 0>();
test<int const, 1>();
test<int const, 7>();
+2 -2
View File
@@ -76,11 +76,11 @@ template<class T, std::size_t N> void test()
int main()
{
// test<int, 0>();
test<int, 0>();
test<int, 1>();
test<int, 7>();
// test<int const, 0>();
test<int const, 0>();
test<int const, 1>();
test<int const, 7>();
+2 -2
View File
@@ -49,11 +49,11 @@ template<class T, std::size_t N> void test3()
int main()
{
// test1<int, 0>();
test1<int, 0>();
test1<int, 1>();
test1<int, 7>();
// test1<int const, 0>();
test1<int const, 0>();
test1<int const, 1>();
test1<int const, 7>();