#include "absl/meta/type_traits.h"
#include <cstdint>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>
#include "gtest/gtest.h"
#include "absl/base/attributes.h"
#include "absl/base/config.h"
#include "absl/time/clock.h"
#include "absl/time/time.h"
#ifdef ABSL_HAVE_STD_STRING_VIEW
#include <string_view>
#endif
namespace {
StaticAssertTypeEq;
IsOwnerAndNotView;
static_assert …;
static_assert …;
static_assert …;
#ifdef ABSL_HAVE_STD_STRING_VIEW
static_assert …;
static_assert …;
#endif
template <class T, class U>
struct simple_pair { … };
struct Dummy { … };
struct ReturnType { … };
struct ConvertibleToReturnType { … };
struct StructA { … };
struct StructB { … };
struct StructC { … };
struct TypeWithBarFunction { … };
struct TypeWithBarFunctionAndConvertibleReturnType { … };
BarIsCallableImpl;
BarIsCallable;
BarIsCallableConv;
TEST(IsDetectedTest, BasicUsage) { … }
TEST(IsDetectedConvertibleTest, BasicUsage) { … }
TEST(VoidTTest, BasicUsage) { … }
TEST(ConjunctionTest, BasicBooleanLogic) { … }
struct MyTrueType { … };
struct MyFalseType { … };
TEST(ConjunctionTest, ShortCircuiting) { … }
TEST(DisjunctionTest, BasicBooleanLogic) { … }
TEST(DisjunctionTest, ShortCircuiting) { … }
TEST(NegationTest, BasicBooleanLogic) { … }
class Trivial { … };
struct TrivialDestructor { … };
struct NontrivialDestructor { … };
struct DeletedDestructor { … };
class TrivialDefaultCtor { … };
class NontrivialDefaultCtor { … };
class DeletedDefaultCtor { … };
class TrivialMoveCtor { … };
class NontrivialMoveCtor { … };
class TrivialCopyCtor { … };
class NontrivialCopyCtor { … };
class DeletedCopyCtor { … };
class TrivialMoveAssign { … };
class NontrivialMoveAssign { … };
class TrivialCopyAssign { … };
class NontrivialCopyAssign { … };
class DeletedCopyAssign { … };
struct MovableNonCopyable { … };
struct NonCopyableOrMovable { … };
class Base { … };
TEST(TypeTraitsTest, TestIsFunction) { … }
TEST(TypeTraitsTest, TestRemoveCVRef) { … }
#define ABSL_INTERNAL_EXPECT_ALIAS_EQUIVALENCE(trait_name, ...) …
TEST(TypeTraitsTest, TestRemoveCVAliases) { … }
TEST(TypeTraitsTest, TestAddCVAliases) { … }
TEST(TypeTraitsTest, TestReferenceAliases) { … }
TEST(TypeTraitsTest, TestPointerAliases) { … }
TEST(TypeTraitsTest, TestSignednessAliases) { … }
TEST(TypeTraitsTest, TestExtentAliases) { … }
TEST(TypeTraitsTest, TestDecay) { … }
struct TypeA { … };
struct TypeB { … };
struct TypeC { … };
struct TypeD { … };
template <typename T>
struct Wrap { … };
enum class TypeEnum { … };
struct GetTypeT { … } constexpr GetType = …;
TEST(TypeTraitsTest, TestEnableIf) { … }
TEST(TypeTraitsTest, TestConditional) { … }
TEST(TypeTraitsTest, TestCommonType) { … }
TEST(TypeTraitsTest, TestUnderlyingType) { … }
struct GetTypeExtT { … } constexpr GetTypeExt = …;
TEST(TypeTraitsTest, TestResultOf) { … }
namespace adl_namespace {
struct DeletedSwap { … };
void swap(DeletedSwap&, DeletedSwap&) = delete;
struct SpecialNoexceptSwap { … };
void swap(SpecialNoexceptSwap&, SpecialNoexceptSwap&) noexcept { … }
}
TEST(TypeTraitsTest, IsSwappable) { … }
TEST(TypeTraitsTest, IsNothrowSwappable) { … }
TEST(TriviallyRelocatable, PrimitiveTypes) { … }
TEST(TriviallyRelocatable, UserDefinedTriviallyRelocatable) { … }
TEST(TriviallyRelocatable, UserProvidedMoveConstructor) { … }
TEST(TriviallyRelocatable, UserProvidedCopyConstructor) { … }
TEST(TriviallyRelocatable, UserProvidedCopyAssignment) { … }
TEST(TriviallyRelocatable, UserProvidedMoveAssignment) { … }
TEST(TriviallyRelocatable, UserProvidedDestructor) { … }
#if defined(ABSL_HAVE_ATTRIBUTE_TRIVIAL_ABI) && \
ABSL_HAVE_BUILTIN(__is_trivially_relocatable) && \
(defined(__cpp_impl_trivially_relocatable) || \
(!defined(__clang__) && !defined(__APPLE__) && !defined(__NVCC__)))
TEST(TriviallyRelocatable, TrivialAbi) {
struct ABSL_ATTRIBUTE_TRIVIAL_ABI S {
S(S&&) {}
S(const S&) {}
void operator=(S&&) {}
void operator=(const S&) {}
~S() {}
};
static_assert(absl::is_trivially_relocatable<S>::value, "");
}
#endif
#ifdef ABSL_HAVE_CONSTANT_EVALUATED
constexpr int64_t NegateIfConstantEvaluated(int64_t i) { … }
#endif
TEST(IsConstantEvaluated, is_constant_evaluated) { … }
}