yarp icon indicating copy to clipboard operation
yarp copied to clipboard

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

Open GiulioRomualdi opened this issue 5 months ago • 1 comments

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: https://github.com/GiulioRomualdi/yarp/commit/0a59ebcd7d32736dc037ac70ac8a555f9f6eb3a4

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.

GiulioRomualdi avatar Jun 03 '25 13:06 GiulioRomualdi