//===-- sanitizer_type_traits.h ---------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // Implements a subset of C++ type traits. This is so we can avoid depending // on system C++ headers. // //===----------------------------------------------------------------------===// #ifndef SANITIZER_TYPE_TRAITS_H #define SANITIZER_TYPE_TRAITS_H namespace __sanitizer { struct true_type { static const bool value = true; }; struct false_type { static const bool value = false; }; // is_same // // Type trait to compare if types are the same. // E.g. // // ``` // is_same::value - True // is_same::value - False // ``` template struct is_same : public false_type {}; template struct is_same : public true_type {}; // conditional // // Defines type as T if B is true or as F otherwise. // E.g. the following is true // // ``` // is_same::type>::value // is_same::type>::value // ``` template struct conditional { using type = T; }; template struct conditional { using type = F; }; } // namespace __sanitizer #endif