StringSet.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. //===--- StringSet.h - The LLVM Compiler Driver -----------------*- C++ -*-===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open
  6. // Source License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. //
  10. // StringSet - A set-like wrapper for the StringMap.
  11. //
  12. //===----------------------------------------------------------------------===//
  13. #ifndef LLVM_ADT_STRINGSET_H
  14. #define LLVM_ADT_STRINGSET_H
  15. #include "llvm/ADT/StringMap.h"
  16. namespace llvm {
  17. /// StringSet - A wrapper for StringMap that provides set-like functionality.
  18. template <class AllocatorTy = llvm::MallocAllocator>
  19. class StringSet : public llvm::StringMap<char, AllocatorTy> {
  20. typedef llvm::StringMap<char, AllocatorTy> base;
  21. public:
  22. std::pair<typename base::iterator, bool> insert(StringRef Key) {
  23. assert(!Key.empty());
  24. return base::insert(std::make_pair(Key, '\0'));
  25. }
  26. };
  27. }
  28. #endif // LLVM_ADT_STRINGSET_H