mardi 2 avril 2019

unable to include circular_buffer in structure

i am new to cpp. I wish to put "boost::circular_buffer histpos(5);" with 5 spaces to store 5 elements inside a cpp structure as member.

i try this :

typedef struct histposRecorder{
   int32_t track_id;
        boost::circular_buffer<float> histpos(5);

}coRecord;

and i get this error :

error: expected identifier before numeric constant
        boost::circular_buffer<float> histpos(5);
error: expected ‘,’ or ‘...’ before numeric constant

this is the circular_buffer website i am referring to: https://www.boost.org/doc/libs/1_49_0/libs/circular_buffer/doc/circular_buffer.html

please show me how to solve it

The reason i want to put it in structure because i will have a lot different copies of circular_buffer to store the velocities of different objects.

Thanks in advance

Aucun commentaire:

Enregistrer un commentaire