Skip to content

Unable to create a message with map<string, map<string, list<double>>> #3237

@GiulioRomualdi

Description

@GiulioRomualdi

Describe the bug
I tried to create a message with map<string, list<map<string, list<double>>>> entry, but the code fails in creating the thrift.
To Reproduce
Steps to reproduce the behavior: I created a commit that can be used to check the problem: GiulioRomualdi@0a59ebc

To reproduce, compile yarp with tests and run

ctest -R idl::thrift::demo::run --output-on-failure

Expected behavior
It should be able to generate the message

Screenshots

This is the error I got

/home/gromualdi-iit.local/robot-code/robotology-superbuild/build/src/YARP/tests/yarpidl_thrift/demo/yarp_idl_to_dir/src/MapOfLists.cpp: In member function 'bool MapOfLists::read_mapOfVectors(yarp::os::idl::WireReader&)':
/home/gromualdi-iit.local/robot-code/robotology-superbuild/build/src/YARP/tests/yarpidl_thrift/demo/yarp_idl_to_dir/src/MapOfLists.cpp:538:53: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type' {aka 'double'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
  538 |                 std::vector<double>& _val = _val[_i][_key];
      |                                                     ^
/home/gromualdi-iit.local/robot-code/robotology-superbuild/build/src/YARP/tests/yarpidl_thrift/demo/yarp_idl_to_dir/src/MapOfLists.cpp: In member function 'bool MapOfLists::nested_read_mapOfVectors(yarp::os::idl::WireReader&)':
/home/gromualdi-iit.local/robot-code/robotology-superbuild/build/src/YARP/tests/yarpidl_thrift/demo/yarp_idl_to_dir/src/MapOfLists.cpp:688:53: error: no match for 'operator[]' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<double>, double>::value_type' {aka 'double'} and 'std::string' {aka 'std::__cxx11::basic_string<char>'})
  688 |                 std::vector<double>& _val = _val[_i][_key];
      |                                                     ^
gmake[2]: *** [CMakeFiles/demo_yarp_idl_to_dir.dir/build.make:219: CMakeFiles/demo_yarp_idl_to_dir.dir/yarp_idl_to_dir/src/MapOfLists.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:90: CMakeFiles/demo_yarp_idl_to_dir.dir/all] Error 2
gmake: *** [Makefile:101: all] Error 2

Configuration (please complete the following information):

  • OS: Ubuntu 24.04
  • yarp version: YARP version 3.10.1
  • compiler: gcc version 13.3.0 (conda-forge gcc 13.3.0-2)

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions