Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <utility>
- #include <memory>
- #include <iostream>
- using namespace std;
- #pragma warning(disable:4100)
- #pragma warning(disable:4702)
- struct CReturnReference
- {
- template <typename tf_CReturn>
- operator tf_CReturn && () const
- {
- return reinterpret_cast<tf_CReturn &&>(*((tf_CReturn *)nullptr));
- }
- template <typename tf_CReturn>
- operator tf_CReturn &() const
- {
- return reinterpret_cast<tf_CReturn &>(*((tf_CReturn *)nullptr));
- }
- };
- class CNullFunctionImpl
- {
- static CReturnReference const & fs_GetReference()
- {
- return *((CReturnReference const *)nullptr);
- }
- public:
- template <typename ...tp_CParams>
- CReturnReference const & operator ()(tp_CParams && ...p_Params) const volatile
- {
- throw "Null call";
- return fs_GetReference();
- }
- };
- void CallFunctionMove(std::unique_ptr<int> &&_UniquePointer)
- {
- }
- void CallFunctionMoveConst(std::unique_ptr<int> const &&_UniquePointer)
- {
- }
- void CallFunctionMoveVolatile(std::unique_ptr<int> volatile &&_UniquePointer)
- {
- }
- void CallFunctionMoveConstVolatile(std::unique_ptr<int> const volatile &&_UniquePointer)
- {
- }
- void CallFunction(std::unique_ptr<int> &_UniquePointer)
- {
- }
- void CallFunctionConst(std::unique_ptr<int> const &_UniquePointer)
- {
- }
- void CallFunctionVolatile(std::unique_ptr<int> volatile &_UniquePointer)
- {
- }
- void CallFunctionConstVolatile(std::unique_ptr<int> const volatile &_UniquePointer)
- {
- }
- int main()
- {
- CNullFunctionImpl Impl;
- try
- {
- CallFunction(Impl());
- CallFunctionConst(Impl());
- CallFunctionVolatile(Impl());
- CallFunctionConstVolatile(Impl());
- CallFunctionMove(Impl());
- CallFunctionMoveConst(Impl());
- CallFunctionMoveVolatile(Impl());
- CallFunctionMoveConstVolatile(Impl());
- }
- catch (char const *_pException)
- {
- cout << "Error: " << _pException << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement