From c09cd7512491cee1e82c1ad8128ce9fd4bc3f79b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 22 Sep 2017 23:32:28 +0200 Subject: Initial modularization with both Clang and VC hacks Note: gave up on VC about half way though. --- libbutl/multi-index.hxx | 59 ------------------------------------------------- 1 file changed, 59 deletions(-) delete mode 100644 libbutl/multi-index.hxx (limited to 'libbutl/multi-index.hxx') diff --git a/libbutl/multi-index.hxx b/libbutl/multi-index.hxx deleted file mode 100644 index 448e1f7..0000000 --- a/libbutl/multi-index.hxx +++ /dev/null @@ -1,59 +0,0 @@ -// file : libbutl/multi-index.hxx -*- C++ -*- -// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd -// license : MIT; see accompanying LICENSE file - -#ifndef LIBBUTL_MULTI_INDEX_HXX -#define LIBBUTL_MULTI_INDEX_HXX - -#include // declval() -#include // hash - -namespace butl -{ - // Google the "Emulating Boost.MultiIndex with Standard Containers" blog - // post for details. - // - - template - struct map_key - { - mutable const T* p; - - map_key (const T* v = 0): p (v) {} - bool operator< (const map_key& x) const {return *p < *x.p;} - bool operator== (const map_key& x) const {return *p == *x.p;} - }; - - template - struct map_iterator_adapter: I - { - typedef const typename I::value_type::second_type value_type; - typedef value_type* pointer; - typedef value_type& reference; - - map_iterator_adapter () {} - map_iterator_adapter (I i): I (i) {} - - map_iterator_adapter& - operator= (I i) {static_cast (*this) = i; return *this;} - - reference operator* () const {return I::operator* ().second;} - pointer operator-> () const {return &I::operator-> ()->second;} - }; -} - -namespace std -{ - template - struct hash>: hash - { - size_t - operator() (butl::map_key x) const - noexcept (noexcept (declval> () (*x.p))) - { - return hash::operator() (*x.p); - } - }; -} - -#endif // LIBBUTL_MULTI_INDEX_HXX -- cgit v1.1