Unordered: fix some gcc issues.

[SVN r71346]
This commit is contained in:
Daniel James
2011-04-17 00:31:35 +00:00
parent 547e141166
commit 140e8852e8
4 changed files with 38 additions and 40 deletions

View File

@ -15,7 +15,7 @@ namespace boost { namespace unordered { namespace detail {
//
// Now the main data structure:
//
// buckets<A, Unique> buffered_functions<H, P>
// buckets<A, Unique> functions<H, P>
// | |
// +---------------+--------------+
// |
@ -323,10 +323,10 @@ namespace boost { namespace unordered { namespace detail {
template <class H, class P> class set_hash_functions;
template <class H, class P>
class buffered_functions
class functions
{
friend class set_hash_functions<H, P>;
buffered_functions& operator=(buffered_functions const&);
functions& operator=(functions const&);
typedef ::boost::compressed_pair<H, P> function_pair;
typedef BOOST_DEDUCED_TYPENAME ::boost::aligned_storage<
@ -358,19 +358,19 @@ namespace boost { namespace unordered { namespace detail {
public:
buffered_functions(H const& hf, P const& eq)
functions(H const& hf, P const& eq)
: current_(false)
{
construct(current_, hf, eq);
}
buffered_functions(buffered_functions const& bf)
functions(functions const& bf)
: current_(false)
{
construct(current_, bf.current());
}
~buffered_functions() {
~functions() {
destroy(current_);
}
@ -389,22 +389,20 @@ namespace boost { namespace unordered { namespace detail {
set_hash_functions(set_hash_functions const&);
set_hash_functions& operator=(set_hash_functions const&);
typedef buffered_functions<H, P> buffered_functions;
buffered_functions& buffered_functions_;
functions<H,P>& functions_;
bool tmp_functions_;
public:
set_hash_functions(buffered_functions& f, H const& h, P const& p)
: buffered_functions_(f),
set_hash_functions(functions<H,P>& f, H const& h, P const& p)
: functions_(f),
tmp_functions_(!f.current_)
{
f.construct(tmp_functions_, h, p);
}
set_hash_functions(buffered_functions& f,
buffered_functions const& other)
: buffered_functions_(f),
set_hash_functions(functions<H,P>& f, functions<H,P> const& other)
: functions_(f),
tmp_functions_(!f.current_)
{
f.construct(tmp_functions_, other.current());
@ -412,12 +410,12 @@ namespace boost { namespace unordered { namespace detail {
~set_hash_functions()
{
buffered_functions_.destroy(tmp_functions_);
functions_.destroy(tmp_functions_);
}
void commit()
{
buffered_functions_.current_ = tmp_functions_;
functions_.current_ = tmp_functions_;
tmp_functions_ = !tmp_functions_;
}
};

View File

@ -12,7 +12,7 @@
namespace boost { namespace unordered { namespace detail {
template <class T>
class equivalent_table : public T::table
class equivalent_table : public T::table_base
{
public:
typedef BOOST_DEDUCED_TYPENAME T::hasher hasher;
@ -20,7 +20,7 @@ namespace boost { namespace unordered { namespace detail {
typedef BOOST_DEDUCED_TYPENAME T::value_allocator value_allocator;
typedef BOOST_DEDUCED_TYPENAME T::key_type key_type;
typedef BOOST_DEDUCED_TYPENAME T::value_type value_type;
typedef BOOST_DEDUCED_TYPENAME T::table table;
typedef BOOST_DEDUCED_TYPENAME T::table_base table_base;
typedef BOOST_DEDUCED_TYPENAME T::node_constructor node_constructor;
typedef BOOST_DEDUCED_TYPENAME T::node node;
@ -32,17 +32,17 @@ namespace boost { namespace unordered { namespace detail {
equivalent_table(std::size_t n,
hasher const& hf, key_equal const& eq, value_allocator const& a)
: table(n, hf, eq, a) {}
: table_base(n, hf, eq, a) {}
equivalent_table(equivalent_table const& x)
: table(x, x.node_alloc()) {}
: table_base(x, x.node_alloc()) {}
equivalent_table(equivalent_table const& x,
value_allocator const& a)
: table(x, a) {}
: table_base(x, a) {}
equivalent_table(equivalent_table& x, move_tag m)
: table(x, m) {}
: table_base(x, m) {}
equivalent_table(equivalent_table& x,
value_allocator const& a, move_tag m)
: table(x, a, m) {}
: table_base(x, a, m) {}
~equivalent_table() {}
// Equality
@ -237,7 +237,7 @@ namespace boost { namespace unordered { namespace detail {
false>
{
typedef equivalent_table<multiset<H, P, A> > impl;
typedef table<multiset<H, P, A> > table;
typedef table<multiset<H, P, A> > table_base;
};
template <class K, class H, class P, class A>
@ -248,7 +248,7 @@ namespace boost { namespace unordered { namespace detail {
false>
{
typedef equivalent_table<multimap<K, H, P, A> > impl;
typedef table<multimap<K, H, P, A> > table;
typedef table<multimap<K, H, P, A> > table_base;
};
}}}

View File

@ -18,7 +18,7 @@ namespace boost { namespace unordered { namespace detail {
// their declaration and implementation.
template <class T>
class table : public T::buckets, public T::buffered_functions
class table : public T::buckets, public T::functions
{
table(table const&);
public:
@ -27,7 +27,7 @@ namespace boost { namespace unordered { namespace detail {
typedef BOOST_DEDUCED_TYPENAME T::value_allocator value_allocator;
typedef BOOST_DEDUCED_TYPENAME T::key_type key_type;
typedef BOOST_DEDUCED_TYPENAME T::value_type value_type;
typedef BOOST_DEDUCED_TYPENAME T::buffered_functions base;
typedef BOOST_DEDUCED_TYPENAME T::functions functions;
typedef BOOST_DEDUCED_TYPENAME T::buckets buckets;
typedef BOOST_DEDUCED_TYPENAME T::extractor extractor;
typedef BOOST_DEDUCED_TYPENAME T::node_constructor node_constructor;
@ -182,7 +182,7 @@ namespace boost { namespace unordered { namespace detail {
key_equal const& eq,
node_allocator const& a)
: buckets(a, next_prime(num_buckets)),
base(hf, eq),
functions(hf, eq),
size_(),
mlf_(1.0f),
max_load_(0)
@ -191,7 +191,7 @@ namespace boost { namespace unordered { namespace detail {
table(table const& x, node_allocator const& a)
: buckets(a, x.min_buckets_for_size(x.size_)),
base(x),
functions(x),
size_(x.size_),
mlf_(x.mlf_),
max_load_(0)
@ -204,7 +204,7 @@ namespace boost { namespace unordered { namespace detail {
table(table& x, move_tag)
: buckets(x.node_alloc(), x.bucket_count_),
base(x),
functions(x),
size_(0),
mlf_(1.0f),
max_load_(0)
@ -214,7 +214,7 @@ namespace boost { namespace unordered { namespace detail {
table(table& x, node_allocator const& a, move_tag)
: buckets(a, x.bucket_count_),
base(x),
functions(x),
size_(0),
mlf_(x.mlf_),
max_load_(0)
@ -579,7 +579,7 @@ namespace boost { namespace unordered { namespace detail {
typedef ::boost::unordered::detail::node_constructor<value_allocator, Unique> node_constructor;
typedef ::boost::unordered::detail::buckets<value_allocator, Unique> buckets;
typedef ::boost::unordered::detail::buffered_functions<hasher, key_equal> buffered_functions;
typedef ::boost::unordered::detail::functions<hasher, key_equal> functions;
typedef BOOST_DEDUCED_TYPENAME buckets::node node;
typedef BOOST_DEDUCED_TYPENAME buckets::bucket bucket;

View File

@ -12,7 +12,7 @@
namespace boost { namespace unordered { namespace detail {
template <class T>
class unique_table : public T::table
class unique_table : public T::table_base
{
public:
typedef BOOST_DEDUCED_TYPENAME T::hasher hasher;
@ -20,7 +20,7 @@ namespace boost { namespace unordered { namespace detail {
typedef BOOST_DEDUCED_TYPENAME T::value_allocator value_allocator;
typedef BOOST_DEDUCED_TYPENAME T::key_type key_type;
typedef BOOST_DEDUCED_TYPENAME T::value_type value_type;
typedef BOOST_DEDUCED_TYPENAME T::table table;
typedef BOOST_DEDUCED_TYPENAME T::table_base table_base;
typedef BOOST_DEDUCED_TYPENAME T::node_constructor node_constructor;
typedef BOOST_DEDUCED_TYPENAME T::node node;
@ -34,16 +34,16 @@ namespace boost { namespace unordered { namespace detail {
unique_table(std::size_t n, hasher const& hf, key_equal const& eq,
value_allocator const& a)
: table(n, hf, eq, a) {}
: table_base(n, hf, eq, a) {}
unique_table(unique_table const& x)
: table(x, x.node_alloc()) {}
: table_base(x, x.node_alloc()) {}
unique_table(unique_table const& x, value_allocator const& a)
: table(x, a) {}
: table_base(x, a) {}
unique_table(unique_table& x, move_tag m)
: table(x, m) {}
: table_base(x, m) {}
unique_table(unique_table& x, value_allocator const& a,
move_tag m)
: table(x, a, m) {}
: table_base(x, a, m) {}
~unique_table() {}
// equals
@ -379,7 +379,7 @@ namespace boost { namespace unordered { namespace detail {
true>
{
typedef ::boost::unordered::detail::unique_table<set<H, P, A> > impl;
typedef ::boost::unordered::detail::table<set<H, P, A> > table;
typedef ::boost::unordered::detail::table<set<H, P, A> > table_base;
};
template <class K, class H, class P, class A>
@ -390,7 +390,7 @@ namespace boost { namespace unordered { namespace detail {
true>
{
typedef ::boost::unordered::detail::unique_table<map<K, H, P, A> > impl;
typedef ::boost::unordered::detail::table<map<K, H, P, A> > table;
typedef ::boost::unordered::detail::table<map<K, H, P, A> > table_base;
};
}}}