// Copyright 2014 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef V8_BASE_FLAGS_H_ #define V8_BASE_FLAGS_H_ #include <cstddef> #include "src/base/compiler-specific.h" namespace v8 { namespace base { // The Flags class provides a type-safe way of storing OR-combinations of enum // values. // // The traditional C++ approach for storing OR-combinations of enum values is to // use an int or unsigned int variable. The inconvenience with this approach is // that there's no type checking at all; any enum value can be OR'd with any // other enum value and passed on to a function that takes an int or unsigned // int. template <typename EnumT, typename BitfieldT = int, typename BitfieldStorageT = BitfieldT> class Flags final { … }; #define DEFINE_OPERATORS_FOR_FLAGS(Type) … } // namespace base } // namespace v8 #endif // V8_BASE_FLAGS_H_