Return two values from a C++ function

Ever wish you could do something like this in C++? Create a function that takes one parameter and returns two values?

        const char * fileBegin;
        const char * fileEnd;
        (fileBegin, fileEnd) = AFunctionThatReturnsAPairOfStrings(fileName);

It is possible, with a slight modification. Returning two items in a struct or class is, of course, not a new idea. But I want the maximum ease for extracting the results and assigning them to variables.

Update: This is exactly what Boost tie does.

        const char * fileBegin;
        const char * fileEnd;
        make_refpair(fileBegin, fileEnd) = mmapFile(fileName);

I've defined a simple class and an accompanying function make_refpair to allow this, which I describe below. It seems like an obvious solution, but I can't quickly find anybody who's done this before. E.g. they miss this on stackoverflow. Of course, there is nothing novel in returning a pair<>, but I want the convenience of assigning both variables to the contents of the returned pair. Anybody seen something similar/better?

Aaron


template <class T1, class T2>
struct RefPair {
T1& e1;
T2& e2;
RefPair(T1 &in1, T2 &in2) : e1(in1), e2(in2) { }
void operator= (pair<T1, T2> source) { e1 = source.first; e2 = source.second; }
};
template <class T1, class T2>
RefPair<T1, T2> make_refpair(T1 &e1, T2 &e2) {
RefPair<T2, T2> rf(e1,e2);
return rf;
}