/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- * vim: set ts=8 sts=2 et sw=2 tw=80: * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// Wrapper type for flags fields based on an enum type. // // EnumFlags does not (implicitly) convert to/from the underlying integer type. // That can be supported for specific flags fields by deriving from this class // and implementing an extra constructor and/or |operator FieldType|. // // Note: this type is similar to mfbt/EnumSet.h, but has the same size in debug // and release builds so is more appropriate for core data structures where we // don't want this size difference. template <typename EnumType> class EnumFlags { protected: // Use the enum's underlying type for the flags field. This makes JIT accesses // more predictable and simplifies the implementation of this class.
static_assert(std::is_enum_v<EnumType>); using FieldType = std::underlying_type_t<EnumType>;
static_assert(std::is_unsigned_v<FieldType>);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.