// Copyright 2018 The Abseil Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // ----------------------------------------------------------------------------- // regularity_aliases.h // ----------------------------------------------------------------------------- // // This file contains type aliases of common ConformanceProfiles and Archetypes // so that they can be directly used by name without creating them from scratch. #ifndef ABSL_TYPES_INTERNAL_CONFORMANCE_ALIASES_H_ #define ABSL_TYPES_INTERNAL_CONFORMANCE_ALIASES_H_ #include "absl/types/internal/conformance_archetype.h" #include "absl/types/internal/conformance_profile.h" namespace absl { namespace types_internal { // Creates both a Profile and a corresponding Archetype with root name "name". #define ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS(name, ...) \ struct name##Profile : __VA_ARGS__ {}; \ \ using name##Archetype = ::absl::types_internal::Archetype; \ \ template \ using name##Archetype##_ = ::absl::types_internal::Archetype< \ ::absl::types_internal::StrongProfileTypedef> ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HasTrivialDefaultConstructor, ConformanceProfile); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HasNothrowDefaultConstructor, ConformanceProfile); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HasDefaultConstructor, ConformanceProfile); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HasTrivialMoveConstructor, ConformanceProfile); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HasNothrowMoveConstructor, ConformanceProfile); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HasMoveConstructor, ConformanceProfile); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HasTrivialCopyConstructor, ConformanceProfile); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HasNothrowCopyConstructor, ConformanceProfile); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HasCopyConstructor, ConformanceProfile); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HasTrivialMoveAssign, ConformanceProfile); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HasNothrowMoveAssign, ConformanceProfile); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HasMoveAssign, ConformanceProfile); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HasTrivialCopyAssign, ConformanceProfile); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HasNothrowCopyAssign, ConformanceProfile); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HasCopyAssign, ConformanceProfile); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HasTrivialDestructor, ConformanceProfile); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HasNothrowDestructor, ConformanceProfile); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HasDestructor, ConformanceProfile); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HasNothrowEquality, ConformanceProfile); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HasEquality, ConformanceProfile); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HasNothrowInequality, ConformanceProfile); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HasInequality, ConformanceProfile); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HasNothrowLessThan, ConformanceProfile); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HasLessThan, ConformanceProfile); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HasNothrowLessEqual, ConformanceProfile); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HasLessEqual, ConformanceProfile); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HasNothrowGreaterEqual, ConformanceProfile< default_constructible::maybe, move_constructible::maybe, copy_constructible::maybe, move_assignable::maybe, copy_assignable::maybe, destructible::maybe, equality_comparable::maybe, inequality_comparable::maybe, less_than_comparable::maybe, less_equal_comparable::maybe, greater_equal_comparable::nothrow>); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HasGreaterEqual, ConformanceProfile< default_constructible::maybe, move_constructible::maybe, copy_constructible::maybe, move_assignable::maybe, copy_assignable::maybe, destructible::maybe, equality_comparable::maybe, inequality_comparable::maybe, less_than_comparable::maybe, less_equal_comparable::maybe, greater_equal_comparable::yes>); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HasNothrowGreaterThan, ConformanceProfile< default_constructible::maybe, move_constructible::maybe, copy_constructible::maybe, move_assignable::maybe, copy_assignable::maybe, destructible::maybe, equality_comparable::maybe, inequality_comparable::maybe, less_than_comparable::maybe, less_equal_comparable::maybe, greater_equal_comparable::maybe, greater_than_comparable::nothrow>); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HasGreaterThan, ConformanceProfile< default_constructible::maybe, move_constructible::maybe, copy_constructible::maybe, move_assignable::maybe, copy_assignable::maybe, destructible::maybe, equality_comparable::maybe, inequality_comparable::maybe, less_than_comparable::maybe, less_equal_comparable::maybe, greater_equal_comparable::maybe, greater_than_comparable::yes>); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HasNothrowSwap, ConformanceProfile< default_constructible::maybe, move_constructible::maybe, copy_constructible::maybe, move_assignable::maybe, copy_assignable::maybe, destructible::maybe, equality_comparable::maybe, inequality_comparable::maybe, less_than_comparable::maybe, less_equal_comparable::maybe, greater_equal_comparable::maybe, greater_than_comparable::maybe, swappable::nothrow>); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HasSwap, ConformanceProfile< default_constructible::maybe, move_constructible::maybe, copy_constructible::maybe, move_assignable::maybe, copy_assignable::maybe, destructible::maybe, equality_comparable::maybe, inequality_comparable::maybe, less_than_comparable::maybe, less_equal_comparable::maybe, greater_equal_comparable::maybe, greater_than_comparable::maybe, swappable::yes>); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HasStdHashSpecialization, ConformanceProfile< default_constructible::maybe, move_constructible::maybe, copy_constructible::maybe, move_assignable::maybe, copy_assignable::maybe, destructible::maybe, equality_comparable::maybe, inequality_comparable::maybe, less_than_comparable::maybe, less_equal_comparable::maybe, greater_equal_comparable::maybe, greater_than_comparable::maybe, swappable::maybe, hashable::yes>); //////////////////////////////////////////////////////////////////////////////// //// The remaining aliases are combinations of the previous aliases. //// //////////////////////////////////////////////////////////////////////////////// ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( Equatable, CombineProfiles); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( Comparable, CombineProfiles); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( NothrowEquatable, CombineProfiles); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( NothrowComparable, CombineProfiles); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( Value, CombineProfiles); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( EquatableValue, CombineProfiles); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( ComparableValue, CombineProfiles); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( DefaultConstructibleValue, CombineProfiles); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( NothrowMoveConstructible, CombineProfiles); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( EquatableNothrowMoveConstructible, CombineProfiles); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( ComparableNothrowMoveConstructible, CombineProfiles); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( DefaultConstructibleNothrowMoveConstructible, CombineProfiles); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( CopyConstructible, CombineProfiles); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( EquatableCopyConstructible, CombineProfiles); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( ComparableCopyConstructible, CombineProfiles); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( DefaultConstructibleCopyConstructible, CombineProfiles); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( NothrowMovable, CombineProfiles); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( EquatableNothrowMovable, CombineProfiles); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( ComparableNothrowMovable, CombineProfiles); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( DefaultConstructibleNothrowMovable, CombineProfiles); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( TrivialSpecialMemberFunctions, CombineProfiles); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( TriviallyComplete, CombineProfiles); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HashableNothrowMoveConstructible, CombineProfiles); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HashableCopyConstructible, CombineProfiles); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HashableNothrowMovable, CombineProfiles); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( HashableValue, CombineProfiles); ABSL_INTERNAL_PROFILE_AND_ARCHETYPE_ALIAS( ComparableHashableValue, CombineProfiles); // The "preferred" profiles that we support in Abseil. template