Skip to content

Instantly share code, notes, and snippets.

@dmonopoly
Last active August 29, 2015 14:03
Show Gist options
  • Save dmonopoly/30a3f4ea1a89a4dc9b68 to your computer and use it in GitHub Desktop.
Save dmonopoly/30a3f4ea1a89a4dc9b68 to your computer and use it in GitHub Desktop.
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
struct One {
string name;
vector<string> values;
};
struct Two {
string name;
vector<One> one_values;
bool operator<(const Two& other) const
{
return name < other.name;
}
};
int main() {
vector<Two> twos;
std::sort(twos.begin(), twos.end());
}
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
struct One {
string name;
vector<string> values;
};
struct Two {
string name;
vector<One> one_values;
};
bool operator<(const Two& lhs, const Two& rhs)
{
return lhs.name < rhs.name;
}
int main() {
vector<Two> twos;
std::sort(twos.begin(), twos.end());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment