Skip to content

No template specialization of convertFromString for LoopString #627

@fmros

Description

@fmros

The LoopString node registered here into the factory lacks a template specialization for convertFromString for std::string. Inserting the node into a behavior tree results in following error:

terminate called after throwing an instance of 'BT::LogicError'
  what():  You didn't implement the template specialization of convertFromString for this type: std::shared_ptr<std::deque<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >

By providing the template specialization

template <> inline
SharedQueue<std::string> convertFromString<SharedQueue<std::string>>(StringView str)
{
  auto parts = splitString(str, ';');
  SharedQueue<std::string> output = std::make_shared<std::deque<std::string>>();
  for (const StringView& part : parts)
  {
    output->push_back(convertFromString<std::string>(part));
  }
  return output;
}

here the issue is fixed. Let me know if I shall file a merge request with the proposed solution.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions