duckhandy/include/duckhandy/scapegoat_map.hpp

51 lines
1.6 KiB
C++

/* Copyright 2016-2020 Michele Santullo
* This file is part of "duckhandy".
*
* "duckhandy" is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* "duckhandy" is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with "duckhandy". If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef idDD2D1A57ABEB4BEEA0F7E46C347D1637
#define idDD2D1A57ABEB4BEEA0F7E46C347D1637
#include "scapegoat_tree.hpp"
namespace duckmem {
template <typename K, typename V, typename Hasher>
class ScapegoatMap {
public:
typedef K key_type;
typedef V value_type;
ScapegoatMap ( void );
~ScapegoatMap ( void );
private:
class DerivedPair : public std::pair<key_type, value_type> {
typedef std::pair<key_type, value_type> parent_type;
public:
DerivedPair ( void );
DerivedPair ( typename Loki::TypeTraits<key_type>::ParameterType parKey, typename Loki::TypeTraits<value_type>::ParameterType parValue );
~DerivedPair ( void );
bool operator< ( const DerivedPair& parOther ) const;
bool operator== ( const DerivedPair& parOther ) const;
};
ScapegoatTree<DerivedPair> m_tree;
};
} //namespace duckmem
#include "implem/scapegoat_map.inl"
#endif