Implement LWG issue 2219 - support reference_wrapper in INVOKE

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@266590 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Eric Fiselier
2016-04-18 06:17:30 +00:00
parent b952822a48
commit 134ff65b8f
11 changed files with 409 additions and 62 deletions

View File

@@ -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); };