30 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// <functional>10 11// reference_wrapper12 13// template <ObjectType T> reference_wrapper<T> ref(T& t);14 15// Don't allow binding to a temp16 17#include <functional>18 19struct A {};20 21const A source() {return A();}22 23int main(int, char**)24{25 std::reference_wrapper<const A> r = std::ref(source());26 (void)r;27 28 return 0;29}30