//===- llvm/ADT/STLExtras.h - Useful STL related functions ------*- 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 // //===----------------------------------------------------------------------===// // // This file contains some templates that are useful if you are working with the // STL at all. // // No library is required when using these functions. // //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_STLEXTRAS_H #define LLVM_ADT_STLEXTRAS_H #include "llvm/ADT/Optional.h" #include "llvm/ADT/STLForwardCompat.h" #include "llvm/ADT/iterator.h" #include "llvm/ADT/iterator_range.h" #include "llvm/Config/abi-breaking.h" #include "llvm/Support/ErrorHandling.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef EXPENSIVE_CHECKS #include // for std::mt19937 #endif namespace llvm { // Only used by compiler if both template types are the same. Useful when // using SFINAE to test for the existence of member functions. template struct SameType; namespace detail { template using IterOfRange = decltype(std::begin(std::declval())); template using ValueOfRange = typename std::remove_reference()))>::type; } // end namespace detail //===----------------------------------------------------------------------===// // Extra additions to //===----------------------------------------------------------------------===// template struct make_const_ptr { using type = typename std::add_pointer::type>::type; }; template struct make_const_ref { using type = typename std::add_lvalue_reference< typename std::add_const::type>::type; }; namespace detail { template using void_t = void; template class Op, class... Args> struct detector { using value_t = std::false_type; }; template