Return empty std::pair from function

Viewed 17823

Is it possible to return an empty pair from a function? Meaning, follow the rules of the function prototype, but do not have any elements in the pair (e.g. NULL). Understanding that a pair simply exists so I don't know if this is conceptually possible. I have a need to return a pair that is NULL or empty, if that makes any sense.

For example,

pair<int, int> MyClass::someFunction()
{

   // do something that means we need to return an empty pair
   return NULL; // <--- this does not work obviously
}

Unfortunately, boost is not a possibility for me.

5 Answers
Related