rippled
aged_associative_container.h
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of Beast: https://github.com/vinniefalco/Beast
4  Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
5 
6  Permission to use, copy, modify, and/or distribute this software for any
7  purpose with or without fee is hereby granted, provided that the above
8  copyright notice and this permission notice appear in all copies.
9 
10  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18 //==============================================================================
19 
20 #ifndef BEAST_CONTAINER_DETAIL_AGED_ASSOCIATIVE_CONTAINER_H_INCLUDED
21 #define BEAST_CONTAINER_DETAIL_AGED_ASSOCIATIVE_CONTAINER_H_INCLUDED
22 
23 #include <type_traits>
24 
25 namespace beast {
26 namespace detail {
27 
28 // Extracts the key portion of value
29 template <bool maybe_map>
31 {
32  explicit aged_associative_container_extract_t() = default;
33 
34  template <class Value>
35  decltype(Value::first) const&
36  operator()(Value const& value) const
37  {
38  return value.first;
39  }
40 };
41 
42 template <>
44 {
45  explicit aged_associative_container_extract_t() = default;
46 
47  template <class Value>
48  Value const&
49  operator()(Value const& value) const
50  {
51  return value;
52  }
53 };
54 
55 } // namespace detail
56 } // namespace beast
57 
58 #endif
beast::detail::aged_associative_container_extract_t
Definition: aged_associative_container.h:30
beast::detail::aged_associative_container_extract_t::aged_associative_container_extract_t
aged_associative_container_extract_t()=default
beast::detail::aged_associative_container_extract_t::operator()
decltype(Value::first) const & operator()(Value const &value) const
Definition: aged_associative_container.h:36
beast::detail::aged_associative_container_extract_t< false >::operator()
Value const & operator()(Value const &value) const
Definition: aged_associative_container.h:49
type_traits
beast
Definition: base_uint.h:641