Template abstract_clock on Clock:

The abstract_clock is now templated on a type meeting the requirements of
the Clock concept. It inherits the nested types of the Clock on which it
is based. This resolves a problem with the original design which broke the
type-safety of time_point from different abstract clocks.
This commit is contained in:
Vinnie Falco
2014-11-20 05:51:47 -08:00
committed by Nik Bougalis
parent d9c49386cb
commit 8aa4a027bb
17 changed files with 448 additions and 558 deletions

View File

@@ -27,12 +27,12 @@ namespace beast {
/** Abstract interface to a clock. /** Abstract interface to a clock.
The abstract clock interface allows a dependency injection to take This makes now() a member function instead of a static member, so
place so that the choice of implementation can be made at run-time an instance of the class can be dependency injected, facilitating
instead of compile time. The trade-off is that the Duration used to unit tests where time may be controlled.
represent the clock must be chosen at compile time and cannot be
changed. This includes both the choice of representation (integers An abstract_clock inherits all the nested types of the Clock
for example) and the period in ticks corresponding to one second. template parameter.
Example: Example:
@@ -40,56 +40,37 @@ namespace beast {
struct Implementation struct Implementation
{ {
abstract_clock <std::chrono::seconds>& m_clock; using clock_type = abstract_clock <std::chrono::steady_clock>;
clock_type& clock_;
// Dependency injection explicit Implementation (clock_type& clock)
// : clock_(clock)
explicit Implementation (
abstract_clock <std::chrono::seconds>& clock)
: m_clock (clock)
{ {
} }
}; };
@endcode @endcode
@tparam The length of time, in seconds, corresponding to one tick. @tparam Clock A type meeting these requirements:
http://en.cppreference.com/w/cpp/concept/Clock
*/ */
template <class Duration> template <class Clock>
class abstract_clock class abstract_clock
{ {
public: public:
typedef typename Duration::rep rep; using rep = typename Clock::rep;
typedef typename Duration::period period; using period = typename Clock::period;
typedef Duration duration; using duration = typename Clock::duration;
typedef std::chrono::time_point < using time_point = typename Clock::time_point;
abstract_clock, duration> time_point;
virtual ~abstract_clock () { } static bool const is_steady = Clock::is_steady;
/** Returns `true` if this is a steady clock. */ virtual ~abstract_clock() = default;
virtual bool is_steady () const = 0;
/** Returns the current time. */ /** Returns the current time. */
virtual time_point now () const = 0; virtual time_point now() const = 0;
#if 0
/** Convert the specified time point to a string. */
/** @{ */
//virtual std::string to_string (time_point const& tp) const = 0;
template <class Duration2>
std::string to_string (
std::chrono::time_point <abstract_clock, Duration2> const& tp) const
{
return to_string (
std::chrono::time_point_cast <Duration> (tp));
}
/** @} */
#endif
/** Returning elapsed ticks since the epoch. */ /** Returning elapsed ticks since the epoch. */
rep elapsed () const rep elapsed()
{ {
return now().time_since_epoch().count(); return now().time_since_epoch().count();
} }
@@ -99,68 +80,34 @@ public:
namespace detail { namespace detail {
template <class TrivialClock, class Duration> template <class Facade, class Clock>
struct basic_abstract_clock_wrapper : public abstract_clock <Duration>
{
using typename abstract_clock <Duration>::duration;
using typename abstract_clock <Duration>::time_point;
bool is_steady () const
{
return TrivialClock::is_steady;
}
time_point now () const
{
return time_point (duration (
std::chrono::duration_cast <duration> (
TrivialClock::now().time_since_epoch ()).count ()));
}
};
template <class TrivialClock, class Duration>
struct abstract_clock_wrapper struct abstract_clock_wrapper
: public basic_abstract_clock_wrapper <TrivialClock, Duration> : public abstract_clock<Facade>
{ {
// generic conversion displays the duration using typename abstract_clock<Facade>::duration;
/* using typename abstract_clock<Facade>::time_point;
std::string to_string (typename basic_abstract_clock_wrapper <
TrivialClock, Duration>::time_point const& tp) const
{
std::stringstream ss;
ss << tp.time_since_epoch();
return ss.str ();
}
*/
};
/* time_point
template <class Duration> now() const override
struct abstract_clock_wrapper <std::chrono::system_clock, Duration>
: public basic_abstract_clock_wrapper <std::chrono::system_clock, Duration>
{
typedef std::chrono::system_clock clock_type;
std::string to_string (time_point const& tp)
{ {
std::stringstream ss; return Clock::now();
ss << clock_type::time_point (tp.time_since_epoch ());
return ss.str ();
} }
}; };
*/
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/** Retrieve a discrete clock for a type implementing the Clock concept. /** Returns a global instance of an abstract clock.
The interface is created as an object with static storage duration. @tparam Facade A type meeting these requirements:
http://en.cppreference.com/w/cpp/concept/Clock
@tparam Clock The actual concrete clock to use.
*/ */
template <class TrivialClock, class Duration> template<class Facade, class Clock = Facade>
abstract_clock <Duration>& get_abstract_clock () abstract_clock<Facade>&
get_abstract_clock()
{ {
static detail::abstract_clock_wrapper < static detail::abstract_clock_wrapper<Facade, Clock> clock;
TrivialClock, Duration> clock;
return clock; return clock;
} }

View File

@@ -1,37 +0,0 @@
//------------------------------------------------------------------------------
/*
This file is part of Beast: https://github.com/vinniefalco/Beast
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#ifndef BEAST_CHRONO_ABSTRACT_CLOCK_IO_H_INCLUDED
#define BEAST_CHRONO_ABSTRACT_CLOCK_IO_H_INCLUDED
#include <beast/chrono/chrono_io.h>
namespace beast {
template <class CharT, class Traits, class Duration, class Resolution>
std::basic_ostream <CharT, Traits>&
operator<< (std::basic_ostream <CharT, Traits>& os,
std::chrono::time_point <abstract_clock <Resolution>, Duration> const& tp)
{
return os << tp.time_since_epoch() << " since epoch";
}
}
#endif

View File

@@ -45,25 +45,25 @@ public:
class seconds_clock_thread class seconds_clock_thread
{ {
public: public:
typedef std::mutex mutex; using mutex = std::mutex;
typedef std::condition_variable cond_var; using cond_var = std::condition_variable;
typedef std::lock_guard <mutex> lock_guard; using lock_guard = std::lock_guard <mutex>;
typedef std::unique_lock <mutex> unique_lock; using unique_lock = std::unique_lock <mutex>;
typedef std::chrono::steady_clock clock_type; using clock_type = std::chrono::steady_clock;
typedef std::chrono::seconds seconds; using seconds = std::chrono::seconds;
typedef std::thread thread; using thread = std::thread;
typedef std::vector <seconds_clock_worker*> workers; using workers = std::vector <seconds_clock_worker*>;
bool m_stop; bool stop_;
mutex m_mutex; mutex mutex_;
cond_var m_cond; cond_var cond_;
workers m_workers; workers workers_;
thread m_thread; thread thread_;
seconds_clock_thread () seconds_clock_thread ()
: m_stop (false) : stop_ (false)
{ {
m_thread = thread (std::bind( thread_ = thread (std::bind(
&seconds_clock_thread::run, this)); &seconds_clock_thread::run, this));
} }
@@ -74,37 +74,37 @@ public:
void add (seconds_clock_worker& w) void add (seconds_clock_worker& w)
{ {
lock_guard lock (m_mutex); lock_guard lock (mutex_);
m_workers.push_back (&w); workers_.push_back (&w);
} }
void remove (seconds_clock_worker& w) void remove (seconds_clock_worker& w)
{ {
lock_guard lock (m_mutex); lock_guard lock (mutex_);
m_workers.erase (std::find ( workers_.erase (std::find (
m_workers.begin (), m_workers.end(), &w)); workers_.begin (), workers_.end(), &w));
} }
void stop() void stop()
{ {
if (m_thread.joinable()) if (thread_.joinable())
{ {
{ {
lock_guard lock (m_mutex); lock_guard lock (mutex_);
m_stop = true; stop_ = true;
} }
m_cond.notify_all(); cond_.notify_all();
m_thread.join(); thread_.join();
} }
} }
void run() void run()
{ {
unique_lock lock (m_mutex);; unique_lock lock (mutex_);;
for (;;) for (;;)
{ {
for (auto iter : m_workers) for (auto iter : workers_)
iter->sample(); iter->sample();
clock_type::time_point const when ( clock_type::time_point const when (
@@ -112,7 +112,7 @@ public:
clock_type::now().time_since_epoch()) + clock_type::now().time_since_epoch()) +
seconds (1)); seconds (1));
if (m_cond.wait_until (lock, when, [this]{ return m_stop; })) if (cond_.wait_until (lock, when, [this]{ return stop_; }))
return; return;
} }
} }
@@ -143,24 +143,26 @@ basic_seconds_clock_main_hook()
} }
/** A clock whose minimum resolution is one second. /** A clock whose minimum resolution is one second.
The purpose of this class is to optimize the performance of the now() The purpose of this class is to optimize the performance of the now()
member function call. It uses a dedicated thread that wakes up at least member function call. It uses a dedicated thread that wakes up at least
once per second to sample the requested trivial clock. once per second to sample the requested trivial clock.
@tparam TrivialClock The clock to sample.
@tparam Clock A type meeting these requirements:
http://en.cppreference.com/w/cpp/concept/Clock
*/ */
template <class TrivialClock> template <class Clock>
class basic_seconds_clock class basic_seconds_clock
{ {
public: public:
typedef std::chrono::seconds resolution; using rep = typename Clock::rep;
typedef typename resolution::rep rep; using period = typename Clock::period;
typedef typename resolution::period period; using duration = typename Clock::duration;
typedef std::chrono::duration <rep, period> duration; using time_point = typename Clock::time_point;
typedef std::chrono::time_point <basic_seconds_clock> time_point;
static bool const is_steady = TrivialClock::is_steady; static bool const is_steady = Clock::is_steady;
static time_point now () static time_point now()
{ {
// Make sure the thread is constructed before the // Make sure the thread is constructed before the
// worker otherwise we will crash during destruction // worker otherwise we will crash during destruction
@@ -176,45 +178,36 @@ public:
struct worker : detail::seconds_clock_worker struct worker : detail::seconds_clock_worker
{ {
typedef std::mutex mutex;
typedef std::lock_guard <mutex> lock_guard;
time_point m_now; time_point m_now;
mutex m_mutex; std::mutex mutex_;
static time_point get_now () worker()
: m_now(Clock::now())
{ {
return time_point (floor <resolution> ( detail::seconds_clock_thread::instance().add(*this);
TrivialClock::now().time_since_epoch()));
} }
worker () ~worker()
: m_now (get_now ())
{ {
detail::seconds_clock_thread::instance().add (*this); detail::seconds_clock_thread::instance().remove(*this);
}
~worker ()
{
detail::seconds_clock_thread::instance().remove (*this);
} }
time_point now() time_point now()
{ {
lock_guard lock (m_mutex); std::lock_guard<std::mutex> lock (mutex_);
return m_now; return m_now;
} }
void sample () void sample()
{ {
lock_guard lock (m_mutex); std::lock_guard<std::mutex> lock (mutex_);
m_now = get_now (); m_now = Clock::now();
} }
}; };
static worker w; static worker w;
return w.now (); return w.now();
} }
}; };

View File

@@ -856,15 +856,15 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
tz = f.get_timezone(); tz = f.get_timezone();
} }
time_t __t = system_clock::to_time_t(__tp); time_t __t = system_clock::to_time_t(__tp);
tm __tm; tm* __tm;
if (tz == local) if (tz == local)
{ {
if (localtime_r(&__t, &__tm) == 0) if (! (__tm = localtime(&__t)))
failed = true; failed = true;
} }
else else
{ {
if (gmtime_r(&__t, &__tm) == 0) if (! (__tm = gmtime(&__t)))
failed = true; failed = true;
} }
if (!failed) if (!failed)
@@ -875,11 +875,11 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
_CharT pattern[] = {'%', 'F', 'T', '%', 'H', ':', '%', 'M', ':'}; _CharT pattern[] = {'%', 'F', 'T', '%', 'H', ':', '%', 'M', ':'};
pb = pattern; pb = pattern;
pe = pb + sizeof(pattern) / sizeof(_CharT); pe = pb + sizeof(pattern) / sizeof(_CharT);
failed = tp.put(__os, __os, __os.fill(), &__tm, pb, pe).failed(); failed = tp.put(__os, __os, __os.fill(), __tm, pb, pe).failed();
if (!failed) if (!failed)
{ {
duration<double> __d = __tp - system_clock::from_time_t(__t) + duration<double> __d = __tp - system_clock::from_time_t(__t) +
seconds(__tm.tm_sec); seconds(__tm->tm_sec);
if (__d.count() < 10) if (__d.count() < 10)
__os << _CharT('0'); __os << _CharT('0');
ios::fmtflags __flgs = __os.flags(); ios::fmtflags __flgs = __os.flags();
@@ -891,7 +891,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
_CharT sub_pattern[] = {' ', '%', 'z'}; _CharT sub_pattern[] = {' ', '%', 'z'};
pb = sub_pattern; pb = sub_pattern;
pe = pb + + sizeof(sub_pattern) / sizeof(_CharT); pe = pb + + sizeof(sub_pattern) / sizeof(_CharT);
failed = tp.put(__os, __os, __os.fill(), &__tm, pb, pe).failed(); failed = tp.put(__os, __os, __os.fill(), __tm, pb, pe).failed();
} }
else else
{ {
@@ -901,7 +901,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
} }
} }
else else
failed = tp.put(__os, __os, __os.fill(), &__tm, pb, pe).failed(); failed = tp.put(__os, __os, __os.fill(), __tm, pb, pe).failed();
} }
} }
catch (...) catch (...)

View File

@@ -25,68 +25,73 @@
namespace beast { namespace beast {
/** Manual clock implementation. /** Manual clock implementation.
This concrete class implements the @ref abstract_clock interface and This concrete class implements the @ref abstract_clock interface and
allows the time to be advanced manually, mainly for the purpose of allows the time to be advanced manually, mainly for the purpose of
providing a clock in unit tests. providing a clock in unit tests.
@tparam The length of time, in seconds, corresponding to one tick.
@tparam Clock A type meeting these requirements:
http://en.cppreference.com/w/cpp/concept/Clock
*/ */
template <class Duration, bool IsSteady = true> template <class Clock>
class manual_clock : public abstract_clock <Duration> class manual_clock
: public abstract_clock<Clock>
{ {
public: public:
using typename abstract_clock <Duration>::rep; using typename abstract_clock<Clock>::rep;
using typename abstract_clock <Duration>::duration; using typename abstract_clock<Clock>::duration;
using typename abstract_clock <Duration>::time_point; using typename abstract_clock<Clock>::time_point;
explicit manual_clock (time_point const& t = time_point (Duration (0)))
: m_now (t)
{
}
bool is_steady () const
{
return IsSteady;
}
time_point now () const
{
return m_now;
}
#if 0
std::string to_string (time_point const& tp) const
{
std::stringstream ss;
ss << tp.time_since_epoch() << " from start";
return ss.str ();
}
#endif
/** Set the current time of the manual clock.
Precondition:
! IsSteady || t > now()
*/
void set (time_point const& t)
{
//if (IsSteady)
m_now = t;
}
/** Convenience for setting the time using a duration in @ref rep units. */
void set (rep v)
{
set (time_point (duration (v)));
}
/** Convenience for advancing the clock by one. */
manual_clock& operator++ ()
{
m_now += duration (1);
return *this;
}
private: private:
time_point m_now; time_point now_;
public:
explicit
manual_clock (time_point const& now = time_point(duration(0)))
: now_(now)
{
}
time_point
now() const override
{
return now_;
}
/** Set the current time of the manual clock. */
void
set (time_point const& when)
{
assert(! Clock::is_steady || when >= now_);
now_ = when;
}
/** Convenience for setting the time in seconds from epoch. */
template <class Integer>
void
set(Integer seconds_from_epoch)
{
set(time_point(duration(
std::chrono::seconds(seconds_from_epoch))));
}
/** Advance the clock by a duration. */
template <class Rep, class Period>
void
advance(std::chrono::duration<Rep, Period> const& elapsed)
{
assert(! Clock::is_steady ||
(now_ + elapsed) >= now_);
now_ += elapsed;
}
/** Convenience for advancing the clock by one second. */
manual_clock&
operator++ ()
{
advance(std::chrono::seconds(1));
return *this;
}
}; };
} }

View File

@@ -20,11 +20,8 @@
// MODULES: ../impl/chrono_io.cpp // MODULES: ../impl/chrono_io.cpp
#include <beast/chrono/abstract_clock.h> #include <beast/chrono/abstract_clock.h>
#include <beast/chrono/abstract_clock_io.h>
#include <beast/chrono/manual_clock.h> #include <beast/chrono/manual_clock.h>
#include <beast/unit_test/suite.h> #include <beast/unit_test/suite.h>
#include <sstream> #include <sstream>
#include <string> #include <string>
#include <thread> #include <thread>
@@ -34,7 +31,8 @@ namespace beast {
class abstract_clock_test : public unit_test::suite class abstract_clock_test : public unit_test::suite
{ {
public: public:
void test (abstract_clock <std::chrono::seconds>& c) template <class Clock>
void test (abstract_clock<Clock>& c)
{ {
{ {
auto const t1 (c.now ()); auto const t1 (c.now ());
@@ -53,18 +51,18 @@ public:
void test_manual () void test_manual ()
{ {
typedef manual_clock <std::chrono::seconds> clock_type; using clock_type = manual_clock<std::chrono::steady_clock>;
clock_type c; clock_type c;
std::stringstream ss; std::stringstream ss;
ss << "now() = " << c.now () << std::endl; ss << "now() = " << c.now().time_since_epoch() << std::endl;
c.set (clock_type::time_point (std::chrono::seconds (1))); c.set (clock_type::time_point (std::chrono::seconds(1)));
ss << "now() = " << c.now () << std::endl; ss << "now() = " << c.now().time_since_epoch() << std::endl;
c.set (clock_type::time_point (std::chrono::seconds (2))); c.set (clock_type::time_point (std::chrono::seconds(2)));
ss << "now() = " << c.now () << std::endl; ss << "now() = " << c.now().time_since_epoch() << std::endl;
log << ss.str(); log << ss.str();
} }
@@ -72,16 +70,16 @@ public:
void run () void run ()
{ {
log << "steady_clock"; log << "steady_clock";
test (get_abstract_clock <std::chrono::steady_clock, test (get_abstract_clock<
std::chrono::seconds> ()); std::chrono::steady_clock>());
log << "system_clock"; log << "system_clock";
test (get_abstract_clock <std::chrono::system_clock, test (get_abstract_clock<
std::chrono::seconds> ()); std::chrono::system_clock>());
log << "high_resolution_clock"; log << "high_resolution_clock";
test (get_abstract_clock <std::chrono::high_resolution_clock, test (get_abstract_clock<
std::chrono::seconds> ()); std::chrono::high_resolution_clock>());
log << "manual_clock"; log << "manual_clock";
test_manual (); test_manual ();

View File

@@ -31,12 +31,12 @@ namespace beast {
template < template <
class Key, class Key,
class T, class T,
class Duration = std::chrono::seconds, class Clock = std::chrono::steady_clock,
class Compare = std::less <Key>, class Compare = std::less <Key>,
class Allocator = std::allocator <std::pair <Key const, T>> class Allocator = std::allocator <std::pair <Key const, T>>
> >
using aged_map = detail::aged_ordered_container < using aged_map = detail::aged_ordered_container <
false, true, Key, T, Duration, Compare, Allocator>; false, true, Key, T, Clock, Compare, Allocator>;
} }

View File

@@ -31,12 +31,12 @@ namespace beast {
template < template <
class Key, class Key,
class T, class T,
class Duration = std::chrono::seconds, class Clock = std::chrono::steady_clock,
class Compare = std::less <Key>, class Compare = std::less <Key>,
class Allocator = std::allocator <std::pair <Key const, T>> class Allocator = std::allocator <std::pair <Key const, T>>
> >
using aged_multimap = detail::aged_ordered_container < using aged_multimap = detail::aged_ordered_container <
true, true, Key, T, Duration, Compare, Allocator>; true, true, Key, T, Clock, Compare, Allocator>;
} }

View File

@@ -30,12 +30,12 @@ namespace beast {
template < template <
class Key, class Key,
class Duration = std::chrono::seconds, class Clock = std::chrono::steady_clock,
class Compare = std::less <Key>, class Compare = std::less <Key>,
class Allocator = std::allocator <Key> class Allocator = std::allocator <Key>
> >
using aged_multiset = detail::aged_ordered_container < using aged_multiset = detail::aged_ordered_container <
true, false, Key, void, Duration, Compare, Allocator>; true, false, Key, void, Clock, Compare, Allocator>;
} }

View File

@@ -30,12 +30,12 @@ namespace beast {
template < template <
class Key, class Key,
class Duration = std::chrono::seconds, class Clock = std::chrono::steady_clock,
class Compare = std::less <Key>, class Compare = std::less <Key>,
class Allocator = std::allocator <Key> class Allocator = std::allocator <Key>
> >
using aged_set = detail::aged_ordered_container < using aged_set = detail::aged_ordered_container <
false, false, Key, void, Duration, Compare, Allocator>; false, false, Key, void, Clock, Compare, Allocator>;
} }

View File

@@ -31,13 +31,13 @@ namespace beast {
template < template <
class Key, class Key,
class T, class T,
class Duration = std::chrono::seconds, class Clock = std::chrono::steady_clock,
class Hash = std::hash <Key>, class Hash = std::hash <Key>,
class KeyEqual = std::equal_to <Key>, class KeyEqual = std::equal_to <Key>,
class Allocator = std::allocator <std::pair <Key const, T>> class Allocator = std::allocator <std::pair <Key const, T>>
> >
using aged_unordered_map = detail::aged_unordered_container < using aged_unordered_map = detail::aged_unordered_container <
false, true, Key, T, Duration, Hash, KeyEqual, Allocator>; false, true, Key, T, Clock, Hash, KeyEqual, Allocator>;
} }

View File

@@ -31,13 +31,13 @@ namespace beast {
template < template <
class Key, class Key,
class T, class T,
class Duration = std::chrono::seconds, class Clock = std::chrono::steady_clock,
class Hash = std::hash <Key>, class Hash = std::hash <Key>,
class KeyEqual = std::equal_to <Key>, class KeyEqual = std::equal_to <Key>,
class Allocator = std::allocator <std::pair <Key const, T>> class Allocator = std::allocator <std::pair <Key const, T>>
> >
using aged_unordered_multimap = detail::aged_unordered_container < using aged_unordered_multimap = detail::aged_unordered_container <
true, true, Key, T, Duration, Hash, KeyEqual, Allocator>; true, true, Key, T, Clock, Hash, KeyEqual, Allocator>;
} }

View File

@@ -30,13 +30,13 @@ namespace beast {
template < template <
class Key, class Key,
class Duration = std::chrono::seconds, class Clock = std::chrono::steady_clock,
class Hash = std::hash <Key>, class Hash = std::hash <Key>,
class KeyEqual = std::equal_to <Key>, class KeyEqual = std::equal_to <Key>,
class Allocator = std::allocator <Key> class Allocator = std::allocator <Key>
> >
using aged_unordered_multiset = detail::aged_unordered_container < using aged_unordered_multiset = detail::aged_unordered_container <
true, false, Key, void, Duration, Hash, KeyEqual, Allocator>; true, false, Key, void, Clock, Hash, KeyEqual, Allocator>;
} }

View File

@@ -30,13 +30,13 @@ namespace beast {
template < template <
class Key, class Key,
class Duration = std::chrono::seconds, class Clock = std::chrono::steady_clock,
class Hash = std::hash <Key>, class Hash = std::hash <Key>,
class KeyEqual = std::equal_to <Key>, class KeyEqual = std::equal_to <Key>,
class Allocator = std::allocator <Key> class Allocator = std::allocator <Key>
> >
using aged_unordered_set = detail::aged_unordered_container < using aged_unordered_set = detail::aged_unordered_container <
false, false, Key, void, Duration, Hash, KeyEqual, Allocator>; false, false, Key, void, Clock, Hash, KeyEqual, Allocator>;
} }

View File

@@ -22,15 +22,11 @@
#include <beast/container/detail/aged_container_iterator.h> #include <beast/container/detail/aged_container_iterator.h>
#include <beast/container/detail/aged_associative_container.h> #include <beast/container/detail/aged_associative_container.h>
#include <beast/container/aged_container.h> #include <beast/container/aged_container.h>
#include <beast/chrono/abstract_clock.h> #include <beast/chrono/abstract_clock.h>
#include <beast/utility/empty_base_optimization.h> #include <beast/utility/empty_base_optimization.h>
#include <boost/intrusive/list.hpp> #include <boost/intrusive/list.hpp>
#include <boost/intrusive/set.hpp> #include <boost/intrusive/set.hpp>
#include <beast/cxx14/algorithm.h> // <algorithm> #include <beast/cxx14/algorithm.h> // <algorithm>
#include <functional> #include <functional>
#include <initializer_list> #include <initializer_list>
@@ -75,7 +71,7 @@ template <
bool IsMap, bool IsMap,
class Key, class Key,
class T, class T,
class Duration = std::chrono::seconds, class Clock = std::chrono::steady_clock,
class Compare = std::less <Key>, class Compare = std::less <Key>,
class Allocator = std::allocator < class Allocator = std::allocator <
typename std::conditional <IsMap, typename std::conditional <IsMap,
@@ -85,25 +81,20 @@ template <
class aged_ordered_container class aged_ordered_container
{ {
public: public:
typedef abstract_clock <Duration> clock_type; using clock_type = abstract_clock<Clock>;
typedef typename clock_type::time_point time_point; using time_point = typename clock_type::time_point;
typedef typename clock_type::duration duration; using duration = typename clock_type::duration;
typedef Key key_type; using key_type = Key;
typedef T mapped_type; using mapped_type = T;
typedef typename std::conditional < using value_type = typename std::conditional <
IsMap, IsMap, std::pair <Key const, T>, Key>::type;
std::pair <Key const, T>, using size_type = std::size_t;
Key>::type value_type; using difference_type = std::ptrdiff_t;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
// Introspection (for unit tests) // Introspection (for unit tests)
typedef std::false_type is_unordered; using is_unordered = std::false_type;
typedef std::integral_constant <bool, IsMulti> is_multi; using is_multi = std::integral_constant <bool, IsMulti>;
typedef std::integral_constant <bool, IsMap> is_map; using is_map = std::integral_constant <bool, IsMap>;
// VFALCO TODO How can we reorder the declarations to keep
// all the public things together contiguously?
private: private:
static Key const& extract (value_type const& value) static Key const& extract (value_type const& value)
@@ -1237,8 +1228,8 @@ private:
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
aged_ordered_container ( aged_ordered_container (
clock_type& clock) clock_type& clock)
: m_config (clock) : m_config (clock)
@@ -1246,8 +1237,8 @@ aged_ordered_container (
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
aged_ordered_container ( aged_ordered_container (
clock_type& clock, clock_type& clock,
Compare const& comp) Compare const& comp)
@@ -1256,8 +1247,8 @@ aged_ordered_container (
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
aged_ordered_container ( aged_ordered_container (
clock_type& clock, clock_type& clock,
Allocator const& alloc) Allocator const& alloc)
@@ -1266,8 +1257,8 @@ aged_ordered_container (
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
aged_ordered_container ( aged_ordered_container (
clock_type& clock, clock_type& clock,
Compare const& comp, Compare const& comp,
@@ -1277,9 +1268,9 @@ aged_ordered_container (
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
template <class InputIt> template <class InputIt>
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
aged_ordered_container (InputIt first, InputIt last, aged_ordered_container (InputIt first, InputIt last,
clock_type& clock) clock_type& clock)
: m_config (clock) : m_config (clock)
@@ -1288,9 +1279,9 @@ aged_ordered_container (InputIt first, InputIt last,
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
template <class InputIt> template <class InputIt>
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
aged_ordered_container (InputIt first, InputIt last, aged_ordered_container (InputIt first, InputIt last,
clock_type& clock, clock_type& clock,
Compare const& comp) Compare const& comp)
@@ -1300,9 +1291,9 @@ aged_ordered_container (InputIt first, InputIt last,
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
template <class InputIt> template <class InputIt>
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
aged_ordered_container (InputIt first, InputIt last, aged_ordered_container (InputIt first, InputIt last,
clock_type& clock, clock_type& clock,
Allocator const& alloc) Allocator const& alloc)
@@ -1312,9 +1303,9 @@ aged_ordered_container (InputIt first, InputIt last,
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
template <class InputIt> template <class InputIt>
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
aged_ordered_container (InputIt first, InputIt last, aged_ordered_container (InputIt first, InputIt last,
clock_type& clock, clock_type& clock,
Compare const& comp, Compare const& comp,
@@ -1325,8 +1316,8 @@ aged_ordered_container (InputIt first, InputIt last,
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
aged_ordered_container (aged_ordered_container const& other) aged_ordered_container (aged_ordered_container const& other)
: m_config (other.m_config) : m_config (other.m_config)
{ {
@@ -1334,8 +1325,8 @@ aged_ordered_container (aged_ordered_container const& other)
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
aged_ordered_container (aged_ordered_container const& other, aged_ordered_container (aged_ordered_container const& other,
Allocator const& alloc) Allocator const& alloc)
: m_config (other.m_config, alloc) : m_config (other.m_config, alloc)
@@ -1344,8 +1335,8 @@ aged_ordered_container (aged_ordered_container const& other,
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
aged_ordered_container (aged_ordered_container&& other) aged_ordered_container (aged_ordered_container&& other)
: m_config (std::move (other.m_config)) : m_config (std::move (other.m_config))
, m_cont (std::move (other.m_cont)) , m_cont (std::move (other.m_cont))
@@ -1354,8 +1345,8 @@ aged_ordered_container (aged_ordered_container&& other)
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
aged_ordered_container (aged_ordered_container&& other, aged_ordered_container (aged_ordered_container&& other,
Allocator const& alloc) Allocator const& alloc)
: m_config (std::move (other.m_config), alloc) : m_config (std::move (other.m_config), alloc)
@@ -1365,8 +1356,8 @@ aged_ordered_container (aged_ordered_container&& other,
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
aged_ordered_container (std::initializer_list <value_type> init, aged_ordered_container (std::initializer_list <value_type> init,
clock_type& clock) clock_type& clock)
: m_config (clock) : m_config (clock)
@@ -1375,8 +1366,8 @@ aged_ordered_container (std::initializer_list <value_type> init,
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
aged_ordered_container (std::initializer_list <value_type> init, aged_ordered_container (std::initializer_list <value_type> init,
clock_type& clock, clock_type& clock,
Compare const& comp) Compare const& comp)
@@ -1386,8 +1377,8 @@ aged_ordered_container (std::initializer_list <value_type> init,
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
aged_ordered_container (std::initializer_list <value_type> init, aged_ordered_container (std::initializer_list <value_type> init,
clock_type& clock, clock_type& clock,
Allocator const& alloc) Allocator const& alloc)
@@ -1397,8 +1388,8 @@ aged_ordered_container (std::initializer_list <value_type> init,
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
aged_ordered_container (std::initializer_list <value_type> init, aged_ordered_container (std::initializer_list <value_type> init,
clock_type& clock, clock_type& clock,
Compare const& comp, Compare const& comp,
@@ -1409,17 +1400,17 @@ aged_ordered_container (std::initializer_list <value_type> init,
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
~aged_ordered_container() ~aged_ordered_container()
{ {
clear(); clear();
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
auto auto
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
operator= (aged_ordered_container const& other) -> operator= (aged_ordered_container const& other) ->
aged_ordered_container& aged_ordered_container&
{ {
@@ -1433,9 +1424,9 @@ operator= (aged_ordered_container const& other) ->
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
auto auto
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
operator= (aged_ordered_container&& other) -> operator= (aged_ordered_container&& other) ->
aged_ordered_container& aged_ordered_container&
{ {
@@ -1447,9 +1438,9 @@ operator= (aged_ordered_container&& other) ->
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
auto auto
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
operator= (std::initializer_list <value_type> init) -> operator= (std::initializer_list <value_type> init) ->
aged_ordered_container& aged_ordered_container&
{ {
@@ -1461,10 +1452,10 @@ operator= (std::initializer_list <value_type> init) ->
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
template <class K, bool maybe_multi, bool maybe_map, class> template <class K, bool maybe_multi, bool maybe_map, class>
typename std::conditional <IsMap, T, void*>::type& typename std::conditional <IsMap, T, void*>::type&
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
at (K const& k) at (K const& k)
{ {
auto const iter (m_cont.find (k, auto const iter (m_cont.find (k,
@@ -1475,10 +1466,10 @@ at (K const& k)
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
template <class K, bool maybe_multi, bool maybe_map, class> template <class K, bool maybe_multi, bool maybe_map, class>
typename std::conditional <IsMap, T, void*>::type const& typename std::conditional <IsMap, T, void*>::type const&
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
at (K const& k) const at (K const& k) const
{ {
auto const iter (m_cont.find (k, auto const iter (m_cont.find (k,
@@ -1489,10 +1480,10 @@ at (K const& k) const
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
template <bool maybe_multi, bool maybe_map, class> template <bool maybe_multi, bool maybe_map, class>
typename std::conditional <IsMap, T, void*>::type& typename std::conditional <IsMap, T, void*>::type&
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
operator[] (Key const& key) operator[] (Key const& key)
{ {
typename cont_type::insert_commit_data d; typename cont_type::insert_commit_data d;
@@ -1511,10 +1502,10 @@ operator[] (Key const& key)
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
template <bool maybe_multi, bool maybe_map, class> template <bool maybe_multi, bool maybe_map, class>
typename std::conditional <IsMap, T, void*>::type& typename std::conditional <IsMap, T, void*>::type&
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
operator[] (Key&& key) operator[] (Key&& key)
{ {
typename cont_type::insert_commit_data d; typename cont_type::insert_commit_data d;
@@ -1536,9 +1527,9 @@ operator[] (Key&& key)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
void void
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
clear() clear()
{ {
for (auto iter (chronological.list.begin()); for (auto iter (chronological.list.begin());
@@ -1550,10 +1541,10 @@ clear()
// map, set // map, set
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
template <bool maybe_multi> template <bool maybe_multi>
auto auto
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
insert (value_type const& value) -> insert (value_type const& value) ->
typename std::enable_if <! maybe_multi, typename std::enable_if <! maybe_multi,
std::pair <iterator, bool>>::type std::pair <iterator, bool>>::type
@@ -1573,10 +1564,10 @@ insert (value_type const& value) ->
// multimap, multiset // multimap, multiset
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
template <bool maybe_multi> template <bool maybe_multi>
auto auto
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
insert (value_type const& value) -> insert (value_type const& value) ->
typename std::enable_if <maybe_multi, typename std::enable_if <maybe_multi,
iterator>::type iterator>::type
@@ -1591,10 +1582,10 @@ insert (value_type const& value) ->
// set // set
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
template <bool maybe_multi, bool maybe_map> template <bool maybe_multi, bool maybe_map>
auto auto
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
insert (value_type&& value) -> insert (value_type&& value) ->
typename std::enable_if <! maybe_multi && ! maybe_map, typename std::enable_if <! maybe_multi && ! maybe_map,
std::pair <iterator, bool>>::type std::pair <iterator, bool>>::type
@@ -1614,10 +1605,10 @@ insert (value_type&& value) ->
// multiset // multiset
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
template <bool maybe_multi, bool maybe_map> template <bool maybe_multi, bool maybe_map>
auto auto
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
insert (value_type&& value) -> insert (value_type&& value) ->
typename std::enable_if <maybe_multi && ! maybe_map, typename std::enable_if <maybe_multi && ! maybe_map,
iterator>::type iterator>::type
@@ -1634,10 +1625,10 @@ insert (value_type&& value) ->
// map, set // map, set
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
template <bool maybe_multi> template <bool maybe_multi>
auto auto
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
insert (const_iterator hint, value_type const& value) -> insert (const_iterator hint, value_type const& value) ->
typename std::enable_if <! maybe_multi, typename std::enable_if <! maybe_multi,
iterator>::type iterator>::type
@@ -1657,10 +1648,10 @@ insert (const_iterator hint, value_type const& value) ->
// map, set // map, set
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
template <bool maybe_multi> template <bool maybe_multi>
auto auto
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
insert (const_iterator hint, value_type&& value) -> insert (const_iterator hint, value_type&& value) ->
typename std::enable_if <! maybe_multi, typename std::enable_if <! maybe_multi,
iterator>::type iterator>::type
@@ -1680,10 +1671,10 @@ insert (const_iterator hint, value_type&& value) ->
// map, set // map, set
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
template <bool maybe_multi, class... Args> template <bool maybe_multi, class... Args>
auto auto
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
emplace (Args&&... args) -> emplace (Args&&... args) ->
typename std::enable_if <! maybe_multi, typename std::enable_if <! maybe_multi,
std::pair <iterator, bool>>::type std::pair <iterator, bool>>::type
@@ -1707,10 +1698,10 @@ emplace (Args&&... args) ->
// multiset, multimap // multiset, multimap
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
template <bool maybe_multi, class... Args> template <bool maybe_multi, class... Args>
auto auto
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
emplace (Args&&... args) -> emplace (Args&&... args) ->
typename std::enable_if <maybe_multi, typename std::enable_if <maybe_multi,
iterator>::type iterator>::type
@@ -1726,10 +1717,10 @@ emplace (Args&&... args) ->
// map, set // map, set
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
template <bool maybe_multi, class... Args> template <bool maybe_multi, class... Args>
auto auto
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
emplace_hint (const_iterator hint, Args&&... args) -> emplace_hint (const_iterator hint, Args&&... args) ->
typename std::enable_if <! maybe_multi, typename std::enable_if <! maybe_multi,
std::pair <iterator, bool>>::type std::pair <iterator, bool>>::type
@@ -1752,10 +1743,10 @@ emplace_hint (const_iterator hint, Args&&... args) ->
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
template <bool is_const, class Iterator, class Base, class> template <bool is_const, class Iterator, class Base, class>
detail::aged_container_iterator <false, Iterator, Base> detail::aged_container_iterator <false, Iterator, Base>
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
erase (detail::aged_container_iterator <is_const, Iterator, Base> pos) erase (detail::aged_container_iterator <is_const, Iterator, Base> pos)
{ {
unlink_and_delete_element(&*((pos++).iterator())); unlink_and_delete_element(&*((pos++).iterator()));
@@ -1764,10 +1755,10 @@ erase (detail::aged_container_iterator <is_const, Iterator, Base> pos)
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
template <bool is_const, class Iterator, class Base, class> template <bool is_const, class Iterator, class Base, class>
detail::aged_container_iterator <false, Iterator, Base> detail::aged_container_iterator <false, Iterator, Base>
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
erase (detail::aged_container_iterator <is_const, Iterator, Base> first, erase (detail::aged_container_iterator <is_const, Iterator, Base> first,
detail::aged_container_iterator <is_const, Iterator, Base> last) detail::aged_container_iterator <is_const, Iterator, Base> last)
{ {
@@ -1779,10 +1770,10 @@ erase (detail::aged_container_iterator <is_const, Iterator, Base> first,
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
template <class K> template <class K>
auto auto
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
erase (K const& k) -> erase (K const& k) ->
size_type size_type
{ {
@@ -1805,9 +1796,9 @@ erase (K const& k) ->
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
void void
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
swap (aged_ordered_container& other) noexcept swap (aged_ordered_container& other) noexcept
{ {
swap_data (other); swap_data (other);
@@ -1818,10 +1809,10 @@ swap (aged_ordered_container& other) noexcept
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
template <class K> template <class K>
auto auto
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
touch (K const& k) -> touch (K const& k) ->
size_type size_type
{ {
@@ -1839,11 +1830,11 @@ touch (K const& k) ->
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
template <bool OtherIsMulti, bool OtherIsMap, template <bool OtherIsMulti, bool OtherIsMap,
class OtherT, class OtherDuration, class OtherAllocator> class OtherT, class OtherDuration, class OtherAllocator>
bool bool
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
operator== ( operator== (
aged_ordered_container <OtherIsMulti, OtherIsMap, aged_ordered_container <OtherIsMulti, OtherIsMap,
Key, OtherT, OtherDuration, Compare, Key, OtherT, OtherDuration, Compare,
@@ -1866,10 +1857,10 @@ operator== (
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
template <bool is_const, class Iterator, class Base, class> template <bool is_const, class Iterator, class Base, class>
void void
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
touch (detail::aged_container_iterator < touch (detail::aged_container_iterator <
is_const, Iterator, Base> pos, is_const, Iterator, Base> pos,
typename clock_type::time_point const& now) typename clock_type::time_point const& now)
@@ -1881,10 +1872,10 @@ touch (detail::aged_container_iterator <
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
template <bool maybe_propagate> template <bool maybe_propagate>
typename std::enable_if <maybe_propagate>::type typename std::enable_if <maybe_propagate>::type
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
swap_data (aged_ordered_container& other) noexcept swap_data (aged_ordered_container& other) noexcept
{ {
std::swap (m_config.key_compare(), other.m_config.key_compare()); std::swap (m_config.key_compare(), other.m_config.key_compare());
@@ -1893,10 +1884,10 @@ swap_data (aged_ordered_container& other) noexcept
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
template <bool maybe_propagate> template <bool maybe_propagate>
typename std::enable_if <! maybe_propagate>::type typename std::enable_if <! maybe_propagate>::type
aged_ordered_container <IsMulti, IsMap, Key, T, Duration, Compare, Allocator>:: aged_ordered_container <IsMulti, IsMap, Key, T, Clock, Compare, Allocator>::
swap_data (aged_ordered_container& other) noexcept swap_data (aged_ordered_container& other) noexcept
{ {
std::swap (m_config.key_compare(), other.m_config.key_compare()); std::swap (m_config.key_compare(), other.m_config.key_compare());
@@ -1908,9 +1899,9 @@ swap_data (aged_ordered_container& other) noexcept
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
struct is_aged_container <detail::aged_ordered_container < struct is_aged_container <detail::aged_ordered_container <
IsMulti, IsMap, Key, T, Duration, Compare, Allocator>> IsMulti, IsMap, Key, T, Clock, Compare, Allocator>>
: std::true_type : std::true_type
{ {
}; };
@@ -1918,22 +1909,22 @@ struct is_aged_container <detail::aged_ordered_container <
// Free functions // Free functions
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator> class Clock, class Compare, class Allocator>
void swap ( void swap (
detail::aged_ordered_container <IsMulti, IsMap, detail::aged_ordered_container <IsMulti, IsMap,
Key, T, Duration, Compare, Allocator>& lhs, Key, T, Clock, Compare, Allocator>& lhs,
detail::aged_ordered_container <IsMulti, IsMap, detail::aged_ordered_container <IsMulti, IsMap,
Key, T, Duration, Compare, Allocator>& rhs) noexcept Key, T, Clock, Compare, Allocator>& rhs) noexcept
{ {
lhs.swap (rhs); lhs.swap (rhs);
} }
/** Expire aged container items past the specified age. */ /** Expire aged container items past the specified age. */
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Compare, class Allocator, class Clock, class Compare, class Allocator,
class Rep, class Period> class Rep, class Period>
std::size_t expire (detail::aged_ordered_container < std::size_t expire (detail::aged_ordered_container <
IsMulti, IsMap, Key, T, Duration, Compare, Allocator>& c, IsMulti, IsMap, Key, T, Clock, Compare, Allocator>& c,
std::chrono::duration <Rep, Period> const& age) std::chrono::duration <Rep, Period> const& age)
{ {
std::size_t n (0); std::size_t n (0);

View File

@@ -22,15 +22,11 @@
#include <beast/container/detail/aged_container_iterator.h> #include <beast/container/detail/aged_container_iterator.h>
#include <beast/container/detail/aged_associative_container.h> #include <beast/container/detail/aged_associative_container.h>
#include <beast/container/aged_container.h> #include <beast/container/aged_container.h>
#include <beast/chrono/abstract_clock.h> #include <beast/chrono/abstract_clock.h>
#include <beast/utility/empty_base_optimization.h> #include <beast/utility/empty_base_optimization.h>
#include <boost/intrusive/list.hpp> #include <boost/intrusive/list.hpp>
#include <boost/intrusive/unordered_set.hpp> #include <boost/intrusive/unordered_set.hpp>
#include <beast/cxx14/algorithm.h> // <algorithm> #include <beast/cxx14/algorithm.h> // <algorithm>
#include <functional> #include <functional>
#include <initializer_list> #include <initializer_list>
@@ -80,7 +76,7 @@ template <
bool IsMap, bool IsMap,
class Key, class Key,
class T, class T,
class Duration = std::chrono::seconds, class Clock = std::chrono::steady_clock,
class Hash = std::hash <Key>, class Hash = std::hash <Key>,
class KeyEqual = std::equal_to <Key>, class KeyEqual = std::equal_to <Key>,
class Allocator = std::allocator < class Allocator = std::allocator <
@@ -91,24 +87,20 @@ template <
class aged_unordered_container class aged_unordered_container
{ {
public: public:
typedef abstract_clock <Duration> clock_type; using clock_type = abstract_clock<Clock>;
typedef typename clock_type::time_point time_point; using time_point = typename clock_type::time_point;
typedef typename clock_type::duration duration; using duration = typename clock_type::duration;
typedef Key key_type; using key_type = Key;
typedef T mapped_type; using mapped_type = T;
typedef typename std::conditional <IsMap, using value_type = typename std::conditional <IsMap,
std::pair <Key const, T>, std::pair <Key const, T>, Key>::type;
Key>::type value_type; using size_type = std::size_t;
typedef std::size_t size_type; using difference_type = std::ptrdiff_t;
typedef std::ptrdiff_t difference_type;
// Introspection (for unit tests) // Introspection (for unit tests)
typedef std::true_type is_unordered; using is_unordered = std::true_type;
typedef std::integral_constant <bool, IsMulti> is_multi; using is_multi = std::integral_constant <bool, IsMulti>;
typedef std::integral_constant <bool, IsMap> is_map; using is_map = std::integral_constant <bool, IsMap>;
// VFALCO TODO How can we reorder the declarations to keep
// all the public things together contiguously?
private: private:
static Key const& extract (value_type const& value) static Key const& extract (value_type const& value)
@@ -1504,8 +1496,8 @@ private:
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
aged_unordered_container ( aged_unordered_container (
clock_type& clock) clock_type& clock)
@@ -1517,8 +1509,8 @@ aged_unordered_container (
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
aged_unordered_container ( aged_unordered_container (
clock_type& clock, clock_type& clock,
@@ -1531,8 +1523,8 @@ aged_unordered_container (
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
aged_unordered_container ( aged_unordered_container (
clock_type& clock, clock_type& clock,
@@ -1545,8 +1537,8 @@ aged_unordered_container (
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
aged_unordered_container ( aged_unordered_container (
clock_type& clock, clock_type& clock,
@@ -1560,8 +1552,8 @@ aged_unordered_container (
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
aged_unordered_container ( aged_unordered_container (
clock_type& clock, clock_type& clock,
@@ -1575,8 +1567,8 @@ aged_unordered_container (
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
aged_unordered_container ( aged_unordered_container (
clock_type& clock, clock_type& clock,
@@ -1591,8 +1583,8 @@ aged_unordered_container (
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
aged_unordered_container ( aged_unordered_container (
clock_type& clock, clock_type& clock,
@@ -1607,8 +1599,8 @@ aged_unordered_container (
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
aged_unordered_container ( aged_unordered_container (
clock_type& clock, clock_type& clock,
@@ -1624,9 +1616,9 @@ aged_unordered_container (
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
template <class InputIt> template <class InputIt>
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
aged_unordered_container (InputIt first, InputIt last, aged_unordered_container (InputIt first, InputIt last,
clock_type& clock) clock_type& clock)
@@ -1639,9 +1631,9 @@ aged_unordered_container (InputIt first, InputIt last,
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
template <class InputIt> template <class InputIt>
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
aged_unordered_container (InputIt first, InputIt last, aged_unordered_container (InputIt first, InputIt last,
clock_type& clock, clock_type& clock,
@@ -1655,9 +1647,9 @@ aged_unordered_container (InputIt first, InputIt last,
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
template <class InputIt> template <class InputIt>
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
aged_unordered_container (InputIt first, InputIt last, aged_unordered_container (InputIt first, InputIt last,
clock_type& clock, clock_type& clock,
@@ -1671,9 +1663,9 @@ aged_unordered_container (InputIt first, InputIt last,
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
template <class InputIt> template <class InputIt>
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
aged_unordered_container (InputIt first, InputIt last, aged_unordered_container (InputIt first, InputIt last,
clock_type& clock, clock_type& clock,
@@ -1688,9 +1680,9 @@ aged_unordered_container (InputIt first, InputIt last,
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
template <class InputIt> template <class InputIt>
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
aged_unordered_container (InputIt first, InputIt last, aged_unordered_container (InputIt first, InputIt last,
clock_type& clock, clock_type& clock,
@@ -1705,9 +1697,9 @@ aged_unordered_container (InputIt first, InputIt last,
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
template <class InputIt> template <class InputIt>
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
aged_unordered_container (InputIt first, InputIt last, aged_unordered_container (InputIt first, InputIt last,
clock_type& clock, clock_type& clock,
@@ -1723,9 +1715,9 @@ aged_unordered_container (InputIt first, InputIt last,
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
template <class InputIt> template <class InputIt>
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
aged_unordered_container (InputIt first, InputIt last, aged_unordered_container (InputIt first, InputIt last,
clock_type& clock, clock_type& clock,
@@ -1741,9 +1733,9 @@ aged_unordered_container (InputIt first, InputIt last,
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
template <class InputIt> template <class InputIt>
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
aged_unordered_container (InputIt first, InputIt last, aged_unordered_container (InputIt first, InputIt last,
clock_type& clock, clock_type& clock,
@@ -1760,8 +1752,8 @@ aged_unordered_container (InputIt first, InputIt last,
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
aged_unordered_container (aged_unordered_container const& other) aged_unordered_container (aged_unordered_container const& other)
: m_config (other.m_config) : m_config (other.m_config)
@@ -1774,8 +1766,8 @@ aged_unordered_container (aged_unordered_container const& other)
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
aged_unordered_container (aged_unordered_container const& other, aged_unordered_container (aged_unordered_container const& other,
Allocator const& alloc) Allocator const& alloc)
@@ -1789,8 +1781,8 @@ aged_unordered_container (aged_unordered_container const& other,
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
aged_unordered_container (aged_unordered_container&& other) aged_unordered_container (aged_unordered_container&& other)
: m_config (std::move (other.m_config)) : m_config (std::move (other.m_config))
@@ -1801,8 +1793,8 @@ aged_unordered_container (aged_unordered_container&& other)
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
aged_unordered_container (aged_unordered_container&& other, aged_unordered_container (aged_unordered_container&& other,
Allocator const& alloc) Allocator const& alloc)
@@ -1817,8 +1809,8 @@ aged_unordered_container (aged_unordered_container&& other,
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
aged_unordered_container (std::initializer_list <value_type> init, aged_unordered_container (std::initializer_list <value_type> init,
clock_type& clock) clock_type& clock)
@@ -1831,8 +1823,8 @@ aged_unordered_container (std::initializer_list <value_type> init,
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
aged_unordered_container (std::initializer_list <value_type> init, aged_unordered_container (std::initializer_list <value_type> init,
clock_type& clock, clock_type& clock,
@@ -1846,8 +1838,8 @@ aged_unordered_container (std::initializer_list <value_type> init,
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
aged_unordered_container (std::initializer_list <value_type> init, aged_unordered_container (std::initializer_list <value_type> init,
clock_type& clock, clock_type& clock,
@@ -1861,8 +1853,8 @@ aged_unordered_container (std::initializer_list <value_type> init,
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
aged_unordered_container (std::initializer_list <value_type> init, aged_unordered_container (std::initializer_list <value_type> init,
clock_type& clock, clock_type& clock,
@@ -1877,8 +1869,8 @@ aged_unordered_container (std::initializer_list <value_type> init,
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
aged_unordered_container (std::initializer_list <value_type> init, aged_unordered_container (std::initializer_list <value_type> init,
clock_type& clock, clock_type& clock,
@@ -1893,8 +1885,8 @@ aged_unordered_container (std::initializer_list <value_type> init,
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
aged_unordered_container (std::initializer_list <value_type> init, aged_unordered_container (std::initializer_list <value_type> init,
clock_type& clock, clock_type& clock,
@@ -1910,8 +1902,8 @@ aged_unordered_container (std::initializer_list <value_type> init,
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
aged_unordered_container (std::initializer_list <value_type> init, aged_unordered_container (std::initializer_list <value_type> init,
clock_type& clock, clock_type& clock,
@@ -1927,8 +1919,8 @@ aged_unordered_container (std::initializer_list <value_type> init,
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
aged_unordered_container (std::initializer_list <value_type> init, aged_unordered_container (std::initializer_list <value_type> init,
clock_type& clock, clock_type& clock,
@@ -1945,8 +1937,8 @@ aged_unordered_container (std::initializer_list <value_type> init,
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
~aged_unordered_container() ~aged_unordered_container()
{ {
@@ -1954,9 +1946,9 @@ aged_unordered_container <IsMulti, IsMap, Key, T, Duration,
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
auto auto
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
operator= (aged_unordered_container const& other) operator= (aged_unordered_container const& other)
-> aged_unordered_container& -> aged_unordered_container&
@@ -1974,9 +1966,9 @@ operator= (aged_unordered_container const& other)
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
auto auto
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
operator= (aged_unordered_container&& other) -> operator= (aged_unordered_container&& other) ->
aged_unordered_container& aged_unordered_container&
@@ -1992,9 +1984,9 @@ operator= (aged_unordered_container&& other) ->
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
auto auto
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
operator= (std::initializer_list <value_type> init) -> operator= (std::initializer_list <value_type> init) ->
aged_unordered_container& aged_unordered_container&
@@ -2007,10 +1999,10 @@ operator= (std::initializer_list <value_type> init) ->
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
template <class K, bool maybe_multi, bool maybe_map, class> template <class K, bool maybe_multi, bool maybe_map, class>
typename std::conditional <IsMap, T, void*>::type& typename std::conditional <IsMap, T, void*>::type&
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
at (K const& k) at (K const& k)
{ {
@@ -2023,10 +2015,10 @@ at (K const& k)
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
template <class K, bool maybe_multi, bool maybe_map, class> template <class K, bool maybe_multi, bool maybe_map, class>
typename std::conditional <IsMap, T, void*>::type const& typename std::conditional <IsMap, T, void*>::type const&
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
at (K const& k) const at (K const& k) const
{ {
@@ -2039,10 +2031,10 @@ at (K const& k) const
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
template <bool maybe_multi, bool maybe_map, class> template <bool maybe_multi, bool maybe_map, class>
typename std::conditional <IsMap, T, void*>::type& typename std::conditional <IsMap, T, void*>::type&
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
operator[] (Key const& key) operator[] (Key const& key)
{ {
@@ -2065,10 +2057,10 @@ operator[] (Key const& key)
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
template <bool maybe_multi, bool maybe_map, class> template <bool maybe_multi, bool maybe_map, class>
typename std::conditional <IsMap, T, void*>::type& typename std::conditional <IsMap, T, void*>::type&
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
operator[] (Key&& key) operator[] (Key&& key)
{ {
@@ -2093,9 +2085,9 @@ operator[] (Key&& key)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
void void
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
clear() clear()
{ {
@@ -2109,10 +2101,10 @@ clear()
// map, set // map, set
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
template <bool maybe_multi> template <bool maybe_multi>
auto auto
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
insert (value_type const& value) -> insert (value_type const& value) ->
typename std::enable_if <! maybe_multi, typename std::enable_if <! maybe_multi,
@@ -2135,10 +2127,10 @@ insert (value_type const& value) ->
// multimap, multiset // multimap, multiset
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
template <bool maybe_multi> template <bool maybe_multi>
auto auto
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
insert (value_type const& value) -> insert (value_type const& value) ->
typename std::enable_if <maybe_multi, typename std::enable_if <maybe_multi,
@@ -2153,10 +2145,10 @@ insert (value_type const& value) ->
// map, set // map, set
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
template <bool maybe_multi, bool maybe_map> template <bool maybe_multi, bool maybe_map>
auto auto
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
insert (value_type&& value) -> insert (value_type&& value) ->
typename std::enable_if <! maybe_multi && ! maybe_map, typename std::enable_if <! maybe_multi && ! maybe_map,
@@ -2179,10 +2171,10 @@ insert (value_type&& value) ->
// multimap, multiset // multimap, multiset
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
template <bool maybe_multi, bool maybe_map> template <bool maybe_multi, bool maybe_map>
auto auto
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
insert (value_type&& value) -> insert (value_type&& value) ->
typename std::enable_if <maybe_multi && ! maybe_map, typename std::enable_if <maybe_multi && ! maybe_map,
@@ -2198,10 +2190,10 @@ insert (value_type&& value) ->
#if 1 // Use insert() instead of insert_check() insert_commit() #if 1 // Use insert() instead of insert_check() insert_commit()
// set, map // set, map
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
template <bool maybe_multi, class... Args> template <bool maybe_multi, class... Args>
auto auto
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
emplace (Args&&... args) -> emplace (Args&&... args) ->
typename std::enable_if <! maybe_multi, typename std::enable_if <! maybe_multi,
@@ -2223,10 +2215,10 @@ emplace (Args&&... args) ->
#else // As original, use insert_check() / insert_commit () pair. #else // As original, use insert_check() / insert_commit () pair.
// set, map // set, map
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
template <bool maybe_multi, class... Args> template <bool maybe_multi, class... Args>
auto auto
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
emplace (Args&&... args) -> emplace (Args&&... args) ->
typename std::enable_if <! maybe_multi, typename std::enable_if <! maybe_multi,
@@ -2254,10 +2246,10 @@ emplace (Args&&... args) ->
// multiset, multimap // multiset, multimap
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
template <bool maybe_multi, class... Args> template <bool maybe_multi, class... Args>
auto auto
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
emplace (Args&&... args) -> emplace (Args&&... args) ->
typename std::enable_if <maybe_multi, typename std::enable_if <maybe_multi,
@@ -2273,10 +2265,10 @@ emplace (Args&&... args) ->
// set, map // set, map
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
template <bool maybe_multi, class... Args> template <bool maybe_multi, class... Args>
auto auto
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
emplace_hint (const_iterator /*hint*/, Args&&... args) -> emplace_hint (const_iterator /*hint*/, Args&&... args) ->
typename std::enable_if <! maybe_multi, typename std::enable_if <! maybe_multi,
@@ -2302,10 +2294,10 @@ emplace_hint (const_iterator /*hint*/, Args&&... args) ->
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
template <bool is_const, class Iterator, class Base> template <bool is_const, class Iterator, class Base>
detail::aged_container_iterator <false, Iterator, Base> detail::aged_container_iterator <false, Iterator, Base>
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
erase (detail::aged_container_iterator < erase (detail::aged_container_iterator <
is_const, Iterator, Base> pos) is_const, Iterator, Base> pos)
@@ -2316,10 +2308,10 @@ erase (detail::aged_container_iterator <
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
template <bool is_const, class Iterator, class Base> template <bool is_const, class Iterator, class Base>
detail::aged_container_iterator <false, Iterator, Base> detail::aged_container_iterator <false, Iterator, Base>
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
erase (detail::aged_container_iterator < erase (detail::aged_container_iterator <
is_const, Iterator, Base> first, is_const, Iterator, Base> first,
@@ -2334,10 +2326,10 @@ erase (detail::aged_container_iterator <
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
template <class K> template <class K>
auto auto
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
erase (K const& k) -> erase (K const& k) ->
size_type size_type
@@ -2361,9 +2353,9 @@ erase (K const& k) ->
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
void void
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
swap (aged_unordered_container& other) noexcept swap (aged_unordered_container& other) noexcept
{ {
@@ -2373,10 +2365,10 @@ swap (aged_unordered_container& other) noexcept
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
template <class K> template <class K>
auto auto
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
touch (K const& k) -> touch (K const& k) ->
size_type size_type
@@ -2393,7 +2385,7 @@ touch (K const& k) ->
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
template < template <
bool OtherIsMap, bool OtherIsMap,
class OtherKey, class OtherKey,
@@ -2405,7 +2397,7 @@ template <
> >
typename std::enable_if <! maybe_multi, bool>::type typename std::enable_if <! maybe_multi, bool>::type
aged_unordered_container < aged_unordered_container <
IsMulti, IsMap, Key, T, Duration, Hash, KeyEqual, Allocator>:: IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::
operator== ( operator== (
aged_unordered_container <false, OtherIsMap, aged_unordered_container <false, OtherIsMap,
OtherKey, OtherT, OtherDuration, OtherHash, KeyEqual, OtherKey, OtherT, OtherDuration, OtherHash, KeyEqual,
@@ -2424,7 +2416,7 @@ operator== (
} }
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
template < template <
bool OtherIsMap, bool OtherIsMap,
class OtherKey, class OtherKey,
@@ -2436,7 +2428,7 @@ template <
> >
typename std::enable_if <maybe_multi, bool>::type typename std::enable_if <maybe_multi, bool>::type
aged_unordered_container < aged_unordered_container <
IsMulti, IsMap, Key, T, Duration, Hash, KeyEqual, Allocator>:: IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>::
operator== ( operator== (
aged_unordered_container <true, OtherIsMap, aged_unordered_container <true, OtherIsMap,
OtherKey, OtherT, OtherDuration, OtherHash, KeyEqual, OtherKey, OtherT, OtherDuration, OtherHash, KeyEqual,
@@ -2469,10 +2461,10 @@ operator== (
// map, set // map, set
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
template <bool maybe_multi> template <bool maybe_multi>
auto auto
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
insert_unchecked (value_type const& value) -> insert_unchecked (value_type const& value) ->
typename std::enable_if <! maybe_multi, typename std::enable_if <! maybe_multi,
@@ -2494,10 +2486,10 @@ insert_unchecked (value_type const& value) ->
// multimap, multiset // multimap, multiset
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
template <bool maybe_multi> template <bool maybe_multi>
auto auto
aged_unordered_container <IsMulti, IsMap, Key, T, Duration, aged_unordered_container <IsMulti, IsMap, Key, T, Clock,
Hash, KeyEqual, Allocator>:: Hash, KeyEqual, Allocator>::
insert_unchecked (value_type const& value) -> insert_unchecked (value_type const& value) ->
typename std::enable_if <maybe_multi, typename std::enable_if <maybe_multi,
@@ -2516,32 +2508,32 @@ insert_unchecked (value_type const& value) ->
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator> class Clock, class Hash, class KeyEqual, class Allocator>
struct is_aged_container <detail::aged_unordered_container < struct is_aged_container <detail::aged_unordered_container <
IsMulti, IsMap, Key, T, Duration, Hash, KeyEqual, Allocator>> IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>>
: std::true_type : std::true_type
{ {
}; };
// Free functions // Free functions
template <bool IsMulti, bool IsMap, class Key, class T, class Duration, template <bool IsMulti, bool IsMap, class Key, class T, class Clock,
class Hash, class KeyEqual, class Allocator> class Hash, class KeyEqual, class Allocator>
void swap ( void swap (
detail::aged_unordered_container <IsMulti, IsMap, detail::aged_unordered_container <IsMulti, IsMap,
Key, T, Duration, Hash, KeyEqual, Allocator>& lhs, Key, T, Clock, Hash, KeyEqual, Allocator>& lhs,
detail::aged_unordered_container <IsMulti, IsMap, detail::aged_unordered_container <IsMulti, IsMap,
Key, T, Duration, Hash, KeyEqual, Allocator>& rhs) noexcept Key, T, Clock, Hash, KeyEqual, Allocator>& rhs) noexcept
{ {
lhs.swap (rhs); lhs.swap (rhs);
} }
/** Expire aged container items past the specified age. */ /** Expire aged container items past the specified age. */
template <bool IsMulti, bool IsMap, class Key, class T, template <bool IsMulti, bool IsMap, class Key, class T,
class Duration, class Hash, class KeyEqual, class Allocator, class Clock, class Hash, class KeyEqual, class Allocator,
class Rep, class Period> class Rep, class Period>
std::size_t expire (detail::aged_unordered_container < std::size_t expire (detail::aged_unordered_container <
IsMulti, IsMap, Key, T, Duration, Hash, KeyEqual, Allocator>& c, IsMulti, IsMap, Key, T, Clock, Hash, KeyEqual, Allocator>& c,
std::chrono::duration <Rep, Period> const& age) noexcept std::chrono::duration <Rep, Period> const& age) noexcept
{ {
std::size_t n (0); std::size_t n (0);

View File

@@ -302,7 +302,7 @@ public:
> >
using Cont = detail::aged_ordered_container < using Cont = detail::aged_ordered_container <
Base::is_multi::value, Base::is_map::value, typename Base::Key, Base::is_multi::value, Base::is_map::value, typename Base::Key,
typename Base::T, typename Base::Dur, Compare, Allocator>; typename Base::T, typename Base::Clock, Compare, Allocator>;
}; };
// unordered // unordered
@@ -318,7 +318,7 @@ public:
> >
using Cont = detail::aged_unordered_container < using Cont = detail::aged_unordered_container <
Base::is_multi::value, Base::is_map::value, Base::is_multi::value, Base::is_map::value,
typename Base::Key, typename Base::T, typename Base::Dur, typename Base::Key, typename Base::T, typename Base::Clock,
Hash, KeyEqual, Allocator>; Hash, KeyEqual, Allocator>;
}; };
@@ -327,8 +327,8 @@ public:
struct TestTraitsBase struct TestTraitsBase
{ {
typedef std::string Key; typedef std::string Key;
typedef std::chrono::seconds Dur; typedef std::chrono::steady_clock Clock;
typedef manual_clock <Dur> Clock; typedef manual_clock<Clock> ManualClock;
}; };
template <bool IsUnordered, bool IsMulti, bool IsMap> template <bool IsUnordered, bool IsMulti, bool IsMap>
@@ -744,12 +744,12 @@ testConstructEmpty ()
typedef typename Traits::Value Value; typedef typename Traits::Value Value;
typedef typename Traits::Key Key; typedef typename Traits::Key Key;
typedef typename Traits::T T; typedef typename Traits::T T;
typedef typename Traits::Dur Dur; typedef typename Traits::Clock Clock;
typedef typename Traits::Comp Comp; typedef typename Traits::Comp Comp;
typedef typename Traits::Alloc Alloc; typedef typename Traits::Alloc Alloc;
typedef typename Traits::MyComp MyComp; typedef typename Traits::MyComp MyComp;
typedef typename Traits::MyAlloc MyAlloc; typedef typename Traits::MyAlloc MyAlloc;
typename Traits::Clock clock; typename Traits::ManualClock clock;
//testcase (Traits::name() + " empty"); //testcase (Traits::name() + " empty");
testcase ("empty"); testcase ("empty");
@@ -789,14 +789,14 @@ testConstructEmpty ()
typedef typename Traits::Value Value; typedef typename Traits::Value Value;
typedef typename Traits::Key Key; typedef typename Traits::Key Key;
typedef typename Traits::T T; typedef typename Traits::T T;
typedef typename Traits::Dur Dur; typedef typename Traits::Clock Clock;
typedef typename Traits::Hash Hash; typedef typename Traits::Hash Hash;
typedef typename Traits::Equal Equal; typedef typename Traits::Equal Equal;
typedef typename Traits::Alloc Alloc; typedef typename Traits::Alloc Alloc;
typedef typename Traits::MyHash MyHash; typedef typename Traits::MyHash MyHash;
typedef typename Traits::MyEqual MyEqual; typedef typename Traits::MyEqual MyEqual;
typedef typename Traits::MyAlloc MyAlloc; typedef typename Traits::MyAlloc MyAlloc;
typename Traits::Clock clock; typename Traits::ManualClock clock;
//testcase (Traits::name() + " empty"); //testcase (Traits::name() + " empty");
testcase ("empty"); testcase ("empty");
@@ -859,12 +859,12 @@ testConstructRange ()
typedef typename Traits::Value Value; typedef typename Traits::Value Value;
typedef typename Traits::Key Key; typedef typename Traits::Key Key;
typedef typename Traits::T T; typedef typename Traits::T T;
typedef typename Traits::Dur Dur; typedef typename Traits::Clock Clock;
typedef typename Traits::Comp Comp; typedef typename Traits::Comp Comp;
typedef typename Traits::Alloc Alloc; typedef typename Traits::Alloc Alloc;
typedef typename Traits::MyComp MyComp; typedef typename Traits::MyComp MyComp;
typedef typename Traits::MyAlloc MyAlloc; typedef typename Traits::MyAlloc MyAlloc;
typename Traits::Clock clock; typename Traits::ManualClock clock;
auto const v (Traits::values()); auto const v (Traits::values());
//testcase (Traits::name() + " range"); //testcase (Traits::name() + " range");
@@ -922,14 +922,14 @@ testConstructRange ()
typedef typename Traits::Value Value; typedef typename Traits::Value Value;
typedef typename Traits::Key Key; typedef typename Traits::Key Key;
typedef typename Traits::T T; typedef typename Traits::T T;
typedef typename Traits::Dur Dur; typedef typename Traits::Clock Clock;
typedef typename Traits::Hash Hash; typedef typename Traits::Hash Hash;
typedef typename Traits::Equal Equal; typedef typename Traits::Equal Equal;
typedef typename Traits::Alloc Alloc; typedef typename Traits::Alloc Alloc;
typedef typename Traits::MyHash MyHash; typedef typename Traits::MyHash MyHash;
typedef typename Traits::MyEqual MyEqual; typedef typename Traits::MyEqual MyEqual;
typedef typename Traits::MyAlloc MyAlloc; typedef typename Traits::MyAlloc MyAlloc;
typename Traits::Clock clock; typename Traits::ManualClock clock;
auto const v (Traits::values()); auto const v (Traits::values());
//testcase (Traits::name() + " range"); //testcase (Traits::name() + " range");
@@ -1002,12 +1002,12 @@ testConstructInitList ()
typedef typename Traits::Value Value; typedef typename Traits::Value Value;
typedef typename Traits::Key Key; typedef typename Traits::Key Key;
typedef typename Traits::T T; typedef typename Traits::T T;
typedef typename Traits::Dur Dur; typedef typename Traits::Clock Clock;
typedef typename Traits::Comp Comp; typedef typename Traits::Comp Comp;
typedef typename Traits::Alloc Alloc; typedef typename Traits::Alloc Alloc;
typedef typename Traits::MyComp MyComp; typedef typename Traits::MyComp MyComp;
typedef typename Traits::MyAlloc MyAlloc; typedef typename Traits::MyAlloc MyAlloc;
typename Traits::Clock clock; typename Traits::ManualClock clock;
//testcase (Traits::name() + " init-list"); //testcase (Traits::name() + " init-list");
testcase ("init-list"); testcase ("init-list");
@@ -1027,14 +1027,14 @@ testConstructInitList ()
typedef typename Traits::Value Value; typedef typename Traits::Value Value;
typedef typename Traits::Key Key; typedef typename Traits::Key Key;
typedef typename Traits::T T; typedef typename Traits::T T;
typedef typename Traits::Dur Dur; typedef typename Traits::Clock Clock;
typedef typename Traits::Hash Hash; typedef typename Traits::Hash Hash;
typedef typename Traits::Equal Equal; typedef typename Traits::Equal Equal;
typedef typename Traits::Alloc Alloc; typedef typename Traits::Alloc Alloc;
typedef typename Traits::MyHash MyHash; typedef typename Traits::MyHash MyHash;
typedef typename Traits::MyEqual MyEqual; typedef typename Traits::MyEqual MyEqual;
typedef typename Traits::MyAlloc MyAlloc; typedef typename Traits::MyAlloc MyAlloc;
typename Traits::Clock clock; typename Traits::ManualClock clock;
//testcase (Traits::name() + " init-list"); //testcase (Traits::name() + " init-list");
testcase ("init-list"); testcase ("init-list");
@@ -1057,7 +1057,7 @@ testCopyMove ()
typedef TestTraits <IsUnordered, IsMulti, IsMap> Traits; typedef TestTraits <IsUnordered, IsMulti, IsMap> Traits;
typedef typename Traits::Value Value; typedef typename Traits::Value Value;
typedef typename Traits::Alloc Alloc; typedef typename Traits::Alloc Alloc;
typename Traits::Clock clock; typename Traits::ManualClock clock;
auto const v (Traits::values()); auto const v (Traits::values());
//testcase (Traits::name() + " copy/move"); //testcase (Traits::name() + " copy/move");
@@ -1139,7 +1139,7 @@ testIterator()
typedef TestTraits <IsUnordered, IsMulti, IsMap> Traits; typedef TestTraits <IsUnordered, IsMulti, IsMap> Traits;
typedef typename Traits::Value Value; typedef typename Traits::Value Value;
typedef typename Traits::Alloc Alloc; typedef typename Traits::Alloc Alloc;
typename Traits::Clock clock; typename Traits::ManualClock clock;
auto const v (Traits::values()); auto const v (Traits::values());
//testcase (Traits::name() + " iterators"); //testcase (Traits::name() + " iterators");
@@ -1202,7 +1202,7 @@ testReverseIterator()
typedef TestTraits <IsUnordered, IsMulti, IsMap> Traits; typedef TestTraits <IsUnordered, IsMulti, IsMap> Traits;
typedef typename Traits::Value Value; typedef typename Traits::Value Value;
typedef typename Traits::Alloc Alloc; typedef typename Traits::Alloc Alloc;
typename Traits::Clock clock; typename Traits::ManualClock clock;
auto const v (Traits::values()); auto const v (Traits::values());
//testcase (Traits::name() + " reverse_iterators"); //testcase (Traits::name() + " reverse_iterators");
@@ -1357,7 +1357,7 @@ aged_associative_container_test_base::
testModifiers() testModifiers()
{ {
typedef TestTraits <IsUnordered, IsMulti, IsMap> Traits; typedef TestTraits <IsUnordered, IsMulti, IsMap> Traits;
typename Traits::Clock clock; typename Traits::ManualClock clock;
auto const v (Traits::values()); auto const v (Traits::values());
auto const l (make_list (v)); auto const l (make_list (v));
@@ -1418,7 +1418,7 @@ testChronological ()
{ {
typedef TestTraits <IsUnordered, IsMulti, IsMap> Traits; typedef TestTraits <IsUnordered, IsMulti, IsMap> Traits;
typedef typename Traits::Value Value; typedef typename Traits::Value Value;
typename Traits::Clock clock; typename Traits::ManualClock clock;
auto const v (Traits::values()); auto const v (Traits::values());
//testcase (Traits::name() + " chronological"); //testcase (Traits::name() + " chronological");
@@ -1484,7 +1484,7 @@ aged_associative_container_test_base::
testArrayCreate() testArrayCreate()
{ {
typedef TestTraits <IsUnordered, IsMulti, IsMap> Traits; typedef TestTraits <IsUnordered, IsMulti, IsMap> Traits;
typename Traits::Clock clock; typename Traits::ManualClock clock;
auto v (Traits::values()); auto v (Traits::values());
//testcase (Traits::name() + " array create"); //testcase (Traits::name() + " array create");
@@ -1522,8 +1522,9 @@ reverseFillAgedContainer (Container& c, Values const& values)
c.clear(); c.clear();
// c.clock() returns an abstract_clock, so dynamic_cast to manual_clock. // c.clock() returns an abstract_clock, so dynamic_cast to manual_clock.
typedef TestTraitsBase::Clock Clock; // VFALCO NOTE This is sketchy
Clock& clk (dynamic_cast <Clock&> (c.clock ())); typedef TestTraitsBase::ManualClock ManualClock;
ManualClock& clk (dynamic_cast <ManualClock&> (c.clock()));
clk.set (0); clk.set (0);
Values rev (values); Values rev (values);
@@ -1626,8 +1627,8 @@ testElementErase ()
testcase ("element erase"); testcase ("element erase");
// Make and fill the container // Make and fill the container
typename Traits::Clock ck; typename Traits::ManualClock clock;
typename Traits::template Cont <> c {ck}; typename Traits::template Cont <> c {clock};
reverseFillAgedContainer (c, Traits::values()); reverseFillAgedContainer (c, Traits::values());
{ {
@@ -1756,8 +1757,8 @@ testRangeErase ()
testcase ("range erase"); testcase ("range erase");
// Make and fill the container // Make and fill the container
typename Traits::Clock ck; typename Traits::ManualClock clock;
typename Traits::template Cont <> c {ck}; typename Traits::template Cont <> c {clock};
reverseFillAgedContainer (c, Traits::values()); reverseFillAgedContainer (c, Traits::values());
// Not bothering to test range erase with reverse iterators. // Not bothering to test range erase with reverse iterators.
@@ -1785,7 +1786,7 @@ testCompare ()
{ {
typedef TestTraits <IsUnordered, IsMulti, IsMap> Traits; typedef TestTraits <IsUnordered, IsMulti, IsMap> Traits;
typedef typename Traits::Value Value; typedef typename Traits::Value Value;
typename Traits::Clock clock; typename Traits::ManualClock clock;
auto const v (Traits::values()); auto const v (Traits::values());
//testcase (Traits::name() + " array create"); //testcase (Traits::name() + " array create");
@@ -1819,7 +1820,7 @@ aged_associative_container_test_base::
testObservers() testObservers()
{ {
typedef TestTraits <IsUnordered, IsMulti, IsMap> Traits; typedef TestTraits <IsUnordered, IsMulti, IsMap> Traits;
typename Traits::Clock clock; typename Traits::ManualClock clock;
//testcase (Traits::name() + " observers"); //testcase (Traits::name() + " observers");
testcase ("observers"); testcase ("observers");
@@ -1838,7 +1839,7 @@ aged_associative_container_test_base::
testObservers() testObservers()
{ {
typedef TestTraits <IsUnordered, IsMulti, IsMap> Traits; typedef TestTraits <IsUnordered, IsMulti, IsMap> Traits;
typename Traits::Clock clock; typename Traits::ManualClock clock;
//testcase (Traits::name() + " observers"); //testcase (Traits::name() + " observers");
testcase ("observers"); testcase ("observers");