mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-30 03:17:15 +02:00
Unordered: Small improvements for windows.
[SVN r73760]
This commit is contained in:
@ -134,8 +134,6 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
|
|
||||||
std::size_t calculate_max_load()
|
std::size_t calculate_max_load()
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(this->buckets_);
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
// From 6.3.1/13:
|
// From 6.3.1/13:
|
||||||
@ -196,7 +194,7 @@ namespace boost { namespace unordered { namespace detail {
|
|||||||
: buckets(x, m),
|
: buckets(x, m),
|
||||||
functions(x),
|
functions(x),
|
||||||
mlf_(x.mlf_),
|
mlf_(x.mlf_),
|
||||||
max_load_(this->buckets_ ? calculate_max_load() : 0) {}
|
max_load_(calculate_max_load()) {}
|
||||||
|
|
||||||
// TODO: Why do I use x's bucket count?
|
// TODO: Why do I use x's bucket count?
|
||||||
table(table& x, node_allocator const& a, move_tag m)
|
table(table& x, node_allocator const& a, move_tag m)
|
||||||
|
@ -149,7 +149,7 @@ namespace test
|
|||||||
// Note that tags will be tested
|
// Note that tags will be tested
|
||||||
// properly in the normal allocator.
|
// properly in the normal allocator.
|
||||||
detail::tracker.track_deallocate((void*) p, n, sizeof(T), tag_,
|
detail::tracker.track_deallocate((void*) p, n, sizeof(T), tag_,
|
||||||
(Flags & propagate_swap));
|
(Flags & propagate_swap) ? true : false);
|
||||||
::operator delete((void*) p);
|
::operator delete((void*) p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,13 +198,13 @@ namespace test
|
|||||||
|
|
||||||
template <typename T, allocator_flags Flags>
|
template <typename T, allocator_flags Flags>
|
||||||
struct is_propagate_on_swap<cxx11_allocator<T, Flags> >
|
struct is_propagate_on_swap<cxx11_allocator<T, Flags> >
|
||||||
: bool_type<(bool)(Flags & propagate_swap)> {};
|
: bool_type<(Flags & propagate_swap) ? true : false> {};
|
||||||
template <typename T, allocator_flags Flags>
|
template <typename T, allocator_flags Flags>
|
||||||
struct is_propagate_on_assign<cxx11_allocator<T, Flags> >
|
struct is_propagate_on_assign<cxx11_allocator<T, Flags> >
|
||||||
: bool_type<(bool)(Flags & propagate_assign)> {};
|
: bool_type<(Flags & propagate_assign) ? true : false> {};
|
||||||
template <typename T, allocator_flags Flags>
|
template <typename T, allocator_flags Flags>
|
||||||
struct is_propagate_on_move<cxx11_allocator<T, Flags> >
|
struct is_propagate_on_move<cxx11_allocator<T, Flags> >
|
||||||
: bool_type<(bool)(Flags & propagate_move)> {};
|
: bool_type<(Flags & propagate_move) ? true : false> {};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -16,6 +16,10 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#if defined(BOOST_MSVC)
|
||||||
|
#pragma warning(disable:4127) // conditional expression is constant
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace assign_tests {
|
namespace assign_tests {
|
||||||
|
|
||||||
test::seed_t seed(96785);
|
test::seed_t seed(96785);
|
||||||
|
@ -15,6 +15,10 @@
|
|||||||
#include "../helpers/equivalent.hpp"
|
#include "../helpers/equivalent.hpp"
|
||||||
#include "../helpers/invariants.hpp"
|
#include "../helpers/invariants.hpp"
|
||||||
|
|
||||||
|
#if defined(BOOST_MSVC)
|
||||||
|
#pragma warning(disable:4127) // conditional expression is constant
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace move_tests
|
namespace move_tests
|
||||||
{
|
{
|
||||||
test::seed_t seed(98624);
|
test::seed_t seed(98624);
|
||||||
|
@ -17,6 +17,10 @@
|
|||||||
#include "../helpers/tracker.hpp"
|
#include "../helpers/tracker.hpp"
|
||||||
#include "../helpers/invariants.hpp"
|
#include "../helpers/invariants.hpp"
|
||||||
|
|
||||||
|
#if defined(BOOST_MSVC)
|
||||||
|
#pragma warning(disable:4127) // conditional expression is constant
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace swap_tests
|
namespace swap_tests
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -38,14 +38,21 @@ namespace unnecessary_copy_tests
|
|||||||
x.tag_ = -1; ++moves;
|
x.tag_ = -1; ++moves;
|
||||||
}
|
}
|
||||||
|
|
||||||
int tag_;
|
count_copies& operator=(BOOST_COPY_ASSIGN_REF(count_copies) p) // Copy assignment
|
||||||
private:
|
{
|
||||||
// I think the standard might require assignment (or move
|
tag_ = p.tag_;
|
||||||
// assignment) for some operations. That Boost.Unordered doesn't
|
++copies;
|
||||||
// is an implementation detail. But these tests are very specific
|
return *this;
|
||||||
// to the implementation, so it's probably okay that this doesn't
|
}
|
||||||
// meet the standard requirements.
|
|
||||||
count_copies& operator=(count_copies const&);
|
count_copies& operator=(BOOST_RV_REF(count_copies) p) //Move assignment
|
||||||
|
{
|
||||||
|
tag_ = p.tag_;
|
||||||
|
++moves;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
int tag_;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool operator==(count_copies const& x, count_copies const& y) {
|
bool operator==(count_copies const& x, count_copies const& y) {
|
||||||
|
Reference in New Issue
Block a user