Skip to content

Commit

Permalink
IndexedMap: Document why SmallVector<T, 0> is preferable here.
Browse files Browse the repository at this point in the history
llvm-svn: 231028
  • Loading branch information
d0k committed Mar 2, 2015
1 parent 59e8c3b commit bb76eaa
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions llvm/include/llvm/ADT/IndexedMap.h
Expand Up @@ -30,6 +30,9 @@ namespace llvm {
template <typename T, typename ToIndexT = llvm::identity<unsigned> >
class IndexedMap {
typedef typename ToIndexT::argument_type IndexT;
// Prefer SmallVector with zero inline storage over std::vector. IndexedMaps
// can grow very large and SmallVector grows more efficiently as long as T
// is trivially copyable.
typedef SmallVector<T, 0> StorageT;
StorageT storage_;
T nullVal_;
Expand Down

0 comments on commit bb76eaa

Please sign in to comment.