MCPcopy Create free account
hub / github.com/davisking/dlib / cast

Method cast

dlib/string/string.h:289–299  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

287 {
288 template < typename charT, typename traits, typename alloc >
289 static const T cast (
290 const std::basic_string<charT,traits,alloc>& str
291 )
292 {
293 std::basic_istringstream<charT,traits,alloc> sin(str);
294 T temp;
295 sin >> temp;
296 if (!sin) throw string_cast_error(narrow(str));
297 if (sin.get() != std::char_traits<charT>::eof()) throw string_cast_error(narrow(str));
298 return temp;
299 }
300 };
301
302 template <typename C, typename T, typename A>

Callers

nothing calls this directly

Calls 3

narrowFunction · 0.85
string_cast_errorClass · 0.70
getMethod · 0.45

Tested by

no test coverage detected