Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions llvm/include/llvm/ADT/IndexedMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,21 @@

#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/identity.h"
#include <cassert>

namespace llvm {

template <typename T, typename ToIndexT = identity<unsigned>> class IndexedMap {
namespace detail {
template <class Ty> struct IdentityIndex {
using argument_type = Ty;

Ty &operator()(Ty &self) const { return self; }
const Ty &operator()(const Ty &self) const { return self; }
};
} // namespace detail

template <typename T, typename ToIndexT = detail::IdentityIndex<unsigned>>
class IndexedMap {
using IndexT = typename ToIndexT::argument_type;
// Prefer SmallVector with zero inline storage over std::vector. IndexedMaps
// can grow very large and SmallVector grows more efficiently as long as T
Expand Down
31 changes: 0 additions & 31 deletions llvm/include/llvm/ADT/identity.h

This file was deleted.