Menu

#7 out-of-box std::pair support

open
nobody
None
5
2009-04-16
2009-04-16
Anonymous
No

following class containing variable of type std::pair<int, int> (std::pair<T> in general) should be exposed without any warnings (just like other STL containers):

#include <utility>

class I
{
public:
I(int a, int b)
{
pair_.first = a;
pair_.second = b;
}
std::pair<int, int> pair_;

int compute(){return pair_.first + pair_.second;}
};

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.