None.h 983 B

1234567891011121314151617181920212223242526
  1. //===-- None.h - Simple null value for implicit construction ------*- C++ -*-=//
  2. //
  3. // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
  4. // See https://llvm.org/LICENSE.txt for license information.
  5. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  6. //
  7. //===----------------------------------------------------------------------===//
  8. //
  9. // This file provides None, an enumerator for use in implicit constructors
  10. // of various (usually templated) types to make such construction more
  11. // terse.
  12. //
  13. //===----------------------------------------------------------------------===//
  14. #ifndef LLVM_ADT_NONE_H
  15. #define LLVM_ADT_NONE_H
  16. namespace llvm {
  17. /// A simple null object to allow implicit construction of Optional<T>
  18. /// and similar types without having to spell out the specialization's name.
  19. // (constant value 1 in an attempt to workaround MSVC build issue... )
  20. enum class NoneType { None = 1 };
  21. const NoneType None = NoneType::None;
  22. }
  23. #endif