@@ -83,60 +83,65 @@ inline T convertFromString(StringView /*str*/)
8383 type_name);
8484}
8585
86- template <>
86+ template <> [[nodiscard]]
8787std::string convertFromString<std::string>(StringView str);
8888
89- template <>
89+ template <> [[nodiscard]]
9090const char * convertFromString<const char *>(StringView str);
9191
92- template <>
92+ template <> [[nodiscard]]
9393int convertFromString<int >(StringView str);
9494
95- template <>
95+ template <> [[nodiscard]]
9696unsigned convertFromString<unsigned >(StringView str);
9797
98- template <>
98+ template <> [[nodiscard]]
9999long convertFromString<long >(StringView str);
100100
101- template <>
101+ template <> [[nodiscard]]
102102unsigned long convertFromString<unsigned long >(StringView str);
103103
104- template <>
104+ template <> [[nodiscard]]
105105float convertFromString<float >(StringView str);
106106
107- template <>
107+ template <> [[nodiscard]]
108108double convertFromString<double >(StringView str);
109109
110- template <> // Integer numbers separated by the character ";"
110+ // Integer numbers separated by the character ";"
111+ template <> [[nodiscard]]
111112std::vector<int > convertFromString<std::vector<int >>(StringView str);
112113
113- template <> // Real numbers separated by the character ";"
114+ // Real numbers separated by the character ";"
115+ template <> [[nodiscard]]
114116std::vector<double > convertFromString<std::vector<double >>(StringView str);
115117
116- template <> // This recognizes either 0/1, true/false, TRUE/FALSE
118+ // This recognizes either 0/1, true/false, TRUE/FALSE
119+ template <> [[nodiscard]]
117120bool convertFromString<bool >(StringView str);
118121
119- template <> // Names with all capital letters
122+ // Names with all capital letters
123+ template <> [[nodiscard]]
120124NodeStatus convertFromString<NodeStatus>(StringView str);
121125
122- template <> // Names with all capital letters
126+ // Names with all capital letters
127+ template <> [[nodiscard]]
123128NodeType convertFromString<NodeType>(StringView str);
124129
125- template <>
130+ template <> [[nodiscard]]
126131PortDirection convertFromString<PortDirection>(StringView str);
127132
128133typedef std::function<Any(StringView)> StringConverter;
129134
130135typedef std::unordered_map<const std::type_info*, StringConverter> StringConvertersMap;
131136
132137// helper function
133- template <typename T>
138+ template <typename T> [[nodiscard]]
134139inline StringConverter GetAnyFromStringFunctor ()
135140{
136141 return [](StringView str) { return Any (convertFromString<T>(str)); };
137142}
138143
139- template <>
144+ template <> [[nodiscard]]
140145inline StringConverter GetAnyFromStringFunctor<void >()
141146{
142147 return {};
@@ -153,10 +158,8 @@ std::string toStr(const T& value)
153158 return std::to_string (value);
154159}
155160
156- template <> [[nodiscard]] inline
157- std::string toStr<bool >(const bool & value) {
158- return value ? " true" : " false" ;
159- }
161+ template <> [[nodiscard]]
162+ std::string toStr<bool >(const bool & value);
160163
161164template <> [[nodiscard]]
162165std::string toStr<std::string>(const std::string& value);
@@ -172,9 +175,6 @@ std::string toStr(BT::NodeStatus status, bool colored);
172175
173176std::ostream& operator <<(std::ostream& os, const BT::NodeStatus& status);
174177
175- /* *
176- * @brief toStr converts NodeType to string.
177- */
178178template <> [[nodiscard]]
179179std::string toStr<BT::NodeType>(const BT::NodeType& type);
180180
0 commit comments