In C++11 you can use std::pair<
std::reference_wrapper
<T>, std::reference_wrapper<U>>
and the objects of that type will behave exactly as you want.
More Related Contents:
- What does the namespace std add? (C++) [closed]
- Why is “using namespace std;” considered bad practice?
- What’s the difference between “STL” and “C++ Standard Library”?
- Can you remove elements from a std::list while iterating through it?
- What is the performance overhead of std::function?
- Sorting zipped (locked) containers in C++ using boost or the STL
- C++ OpenMP Parallel For Loop – Alternatives to std::vector [closed]
- Compelling examples of custom C++ allocators?
- How to get error message when ifstream open fails
- How do I Search/Find and Replace in a standard string?
- std::shared_ptr thread safety
- Search for a struct item in a vector by member data
- When is it necessary to use the flag -stdlib=libstdc++?
- How to reset std::cin when using it?
- How to use std::async on a member function?
- Will specialization of function templates in std for program-defined types no longer be allowed in C++20?
- Can we rely on the reduce-capacity trick?
- std::put_time implementation status in GCC?
- Why am I getting string does not name a type Error?
- What is the difference between using a struct with two fields and a pair?
- Is there a range class in C++11 for use with range based for loops?
- std::vector resize downward
- std::thread error (thread not member of std)
- stoi and std::to_string on mingw 4.7.1 [duplicate]
- Why does unique_ptr take two template parameters when shared_ptr only takes one?
- What is the use of “using namespace std”? [duplicate]
- Why Can’t I store references in a `std::map` in C++?
- C++ std::tuple order of destruction
- what does `using std::swap` inside the body of a class method implementation mean?
- Conversion from boost::shared_ptr to std::shared_ptr?