[Rock-dev] std::vector<bool> allowed in types ?

Thomas Roehr thomas.roehr at dfki.de
Wed Jul 11 14:04:07 CEST 2012


On 11.07.2012 13:19, Janosch Machowinski wrote:
> Hi,
> I know that there is an issue with the bool type.
Typelib will treat it as standard container, but it is actually not a 
container which might lead to the issue here:
http://gcc.gnu.org/onlinedocs/gcc-4.6.3/libstdc++/api/a00740.html see 
section detailled description
or
http://en.wikipedia.org/wiki/Sequence_container_%28C%2B%2B%29#Specialization_for_bool

> Sadly I don't know the reason or have any detail
> on when or where it is allowed. As a workaround
> one can use uint8_t.
I would still consider this a bug since std::vector<bool> is a valid 
type and an error message should be produced at least.

Thomas
> Greetings
>       Janosch
>
> On 11.07.2012 12:28, Felix Rehrmann wrote:
>> Hi all,
>>
>> in Virgo we had the following data structure:
>>
>>        struct Bumpers
>>        {
>>            // Number of Bumpers (specific per Robot)
>>            int nrFront;
>>            int nrRear;
>>            // States of Bumpers. See Aria Documentation and/or ArModes.cpp
>>            // for an Example how to read out these values.
>>            int front;
>>            int rear;
>>
>>            std::vector<bool>  bumpersFront;
>>            std::vector<bool>  bumpersRear;
>>
>>            base::Time time;
>>        };
>>
>> When connecting to a port with this type via orocos.rb a segmentation
>> fault happened.
>> After changing std::vector<bool>  to std::vector<int>  the segmentation
>> fault was gone.
>>
>> The questions is whether std::vector<bool>  is not allowed at all (e.g.
>> typelib cannot interpret it correctly,
>> maybe because the interpretation of bool is not clear) or that this is a
>> bug or missing feature?
>>
>> Thanks
>> Felix
>>
>>
>
Thomas

-- 
Thomas Röhr (M.Sc.)
Space Robotics

Standort Bremen:
DFKI GmbH
Robotics Innovation Center
Robert-Hooke-Straße 5
28359 Bremen, Germany

Phone: +49 (0)421 178-454151
Fax:   +49 (0)421 178-454150
E-Mail: robotik at dfki.de

Weitere Informationen: http://www.dfki.de/robotik
-----------------------------------------------------------------------
Deutsches Forschungszentrum fuer Kuenstliche Intelligenz GmbH
Firmensitz: Trippstadter Straße 122, D-67663 Kaiserslautern
Geschaeftsfuehrung: Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster
(Vorsitzender) Dr. Walter Olthoff
Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
Amtsgericht Kaiserslautern, HRB 2313
Sitz der Gesellschaft: Kaiserslautern (HRB 2313)
USt-Id.Nr.:    DE 148646973
Steuernummer:  19/673/0060/3
-----------------------------------------------------------------------



More information about the Rock-dev mailing list