#include <vector>
#include <algorithm>
#include <iostream>

using namespace std;

struct Vector3D
{
   float x,y,z;
};

bool operator < (const Vector3D& a, const Vector3D& b)
{
    if (a.x < b.x) return true;
    if (a.x > b.x) return false;

    if (a.y < b.y) return true;
    if (a.y > b.y) return false;

    if (a.z < b.z) return true;
    if (a.z > b.z) return false;

    return false;
}


int main(int argc, char * argv[])
{

    vector<Vector3D> v = {
        {-0.5, -0.5, -0.5},
        {0.0, -0.5, -0.5},
        {0.5, -0.5, -0.5},

        {0.5, -0.5, 0.0},
        {0.5, -0.5, 0.5},
        {0.0, -0.5, 0.5},

        {-0.5, -0.5, 0.5},
        {-0.5, -0.5, 0.0}
    };

    sort(v.begin(),v.end());

    for(int i = 0; i < v.size(); ++i)
        cout << v[i].x << "  " << v[i].y << "  " << v[i].z << endl;

}
