
#include <iterator>
#include <iostream>
#include <vector>
#include <fstream>

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

struct  joint_angle
{
    int count;
    Vector3 orient;
};
 
struct pose
{
    float time;
    std::vector<joint_angle> angle;
};
 
std::vector<pose> posture;

// opérateur pour lire un "joint_angle"
std::istream & operator>> (std::istream & stream, joint_angle & ja) 
{
    ja.count = 0;
    stream >> ja.orient.x >> ja.orient.y >> ja.orient.z;
    return stream;
}
 
// opérateur pour lire un "pose"
std::istream & operator>> (std::istream & stream, pose & p) 
{
    p.time = 0;
    std::copy(std::istream_iterator<joint_angle>(stream), std::istream_iterator<joint_angle>(), std::back_inserter(p.angle));
    return stream;
}
 
// pour lire un fichier
int main()
{
    std::ifstream stream("fichier.txt" );
    if (stream)
    {
        // test operator >> joint_angle
        joint_angle ja;
        stream >> ja;
    
        // test operator >> pose
        pose p;
        stream >> p;
    }
}
