[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / libcxx / test / support / unwrap_container_adaptor.h
blob19f79430045da50e3e418c90e4ded17f8cf76cbf
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #ifndef SUPPORT_UNWRAP_CONTAINER_ADAPTOR_H
10 #define SUPPORT_UNWRAP_CONTAINER_ADAPTOR_H
12 // Allows accessing the underlying container of the given adaptor.
13 template <class Adaptor>
14 struct UnwrapAdaptor : Adaptor {
15 UnwrapAdaptor() = default;
17 UnwrapAdaptor(Adaptor&& adaptor) : Adaptor(std::move(adaptor)) {}
18 // `c` is a protected member variable of the base class.
19 decltype(auto) get_container() {
20 return (UnwrapAdaptor::c); // Put into parentheses to make sure the function returns a reference.
23 // TODO: make this work pre-C++20.
24 decltype(auto) get_comparator()
25 requires requires {
26 UnwrapAdaptor::c;
27 } {
28 return (UnwrapAdaptor::comp); // Put into parentheses to make sure the function returns a reference.
32 #endif // SUPPORT_UNWRAP_CONTAINER_ADAPTOR_H