cppx-core
Sorted_map_.hpp
Go to the documentation of this file.
1 #pragma once // Source encoding: UTF-8 with BOM (π is a lowercase Greek "pi").
2 
3 #include <cppx-core/language/syntax/macro-use.hpp> // CPPX_USE_STD
4 #include <cppx-core/language/types/Truth.hpp> // cppx::Truth
5 
6 #include <map> // std::map
7 
8 namespace cppx
9 {
10  CPPX_USE_STD( map );
11 
12  template< class Key, class Value >
14  : public map<Key, Value>
15  {
16  using Base = map<Key, Value>;
17  public:
18  using Base::map;
19  using Base::operator[];
20 
21  auto operator[]( const Key& key ) const
22  -> const Value&
23  { return Base::at( key ); }
24  };
25 
26  template< class Key, class Value, class Arg >
27  auto is_in( const Sorted_map_<Key, Value>& map, const Arg& v )
28  -> Truth
29  { return map.count( v ) > 0; }
30 
31 } // namespace cppx
A drop-in replacement for bool without implicit conversion from/to types other than bool.
Definition: Truth.hpp:34
auto is_in(const basic_string_view< Char > &sv, const Char ch) noexcept -> Truth
Definition: is_in.hpp:21
Truth is a drop-in replacement for bool without implicit conversion from/to types other than bool.
CPPX_USE_STD(basic_string, basic_string_view, bitset, char_traits, size)
auto operator[](const Key &key) const -> const Value &
Definition: Sorted_map_.hpp:21
Macros for generating more concise and clear using statements, primarily $use_cppx and $use_std,...