diff options
author | Eric Fiselier <eric@efcs.ca> | 2016-04-18 06:17:30 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2016-04-18 06:17:30 +0000 |
commit | 2152fd7682e3725449fc6483141dc55fc80dad16 (patch) | |
tree | ffc09c3c81b33127dc7ea73eccf76d9b8272de4a /libcxx/test/std/utilities/function.objects/func.require/invoke_helpers.h | |
parent | 76a7ca0f67379705773c4d1da89e546667ff25f2 (diff) | |
download | bcm5719-llvm-2152fd7682e3725449fc6483141dc55fc80dad16.tar.gz bcm5719-llvm-2152fd7682e3725449fc6483141dc55fc80dad16.zip |
Implement LWG issue 2219 - support reference_wrapper in INVOKE
llvm-svn: 266590
Diffstat (limited to 'libcxx/test/std/utilities/function.objects/func.require/invoke_helpers.h')
-rw-r--r-- | libcxx/test/std/utilities/function.objects/func.require/invoke_helpers.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/libcxx/test/std/utilities/function.objects/func.require/invoke_helpers.h b/libcxx/test/std/utilities/function.objects/func.require/invoke_helpers.h index a85b39f3717..495703d0e32 100644 --- a/libcxx/test/std/utilities/function.objects/func.require/invoke_helpers.h +++ b/libcxx/test/std/utilities/function.objects/func.require/invoke_helpers.h @@ -79,6 +79,40 @@ typedef Caster<Q_Const, true> MoveConstCaster; typedef Caster<Q_Volatile, true> MoveVolatileCaster; typedef Caster<Q_CV, true> MoveCVCaster; + +template <class Tp> +Tp const& makeConst(Tp& ref) { return ref; } + +template <class Tp> +Tp const* makeConst(Tp* ptr) { return ptr; } + +template <class Tp> +std::reference_wrapper<const Tp> makeConst(std::reference_wrapper<Tp>& ref) { + return std::reference_wrapper<const Tp>(ref.get()); +} + +template <class Tp> +Tp volatile& makeVolatile(Tp& ref) { return ref; } + +template <class Tp> +Tp volatile* makeVolatile(Tp* ptr) { return ptr; } + +template <class Tp> +std::reference_wrapper<volatile Tp> makeVolatile(std::reference_wrapper<Tp>& ref) { + return std::reference_wrapper<volatile Tp>(ref.get()); +} + +template <class Tp> +Tp const volatile& makeCV(Tp& ref) { return ref; } + +template <class Tp> +Tp const volatile* makeCV(Tp* ptr) { return ptr; } + +template <class Tp> +std::reference_wrapper<const volatile Tp> makeCV(std::reference_wrapper<Tp>& ref) { + return std::reference_wrapper<const volatile Tp>(ref.get()); +} + // A shorter name for 'static_cast' template <class QualType, class Tp> QualType C_(Tp& v) { return static_cast<QualType>(v); }; |