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

Function narrow

dlib/string/string.h:30–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28 typename alloc
29 >
30 inline const typename disable_if<is_same_type<charT,char>,std::string>::type narrow (
31 const std::basic_string<charT,traits,alloc>& str
32 )
33 {
34 std::string temp;
35 temp.reserve(str.size());
36 std::string::size_type i;
37 for (i = 0; i < str.size(); ++i)
38 {
39 if (zero_extend_cast<unsigned long>(str[i]) > 255)
40 temp += ' ';
41 else
42 temp += zero_extend_cast<char>(str[i]);
43 }
44 return temp;
45 }
46
47 template <
48 typename charT,

Callers 11

set_node_labelMethod · 0.85
node_labelMethod · 0.85
set_textMethod · 0.85
castMethod · 0.85
castMethod · 0.85
add_optionMethod · 0.85
set_info_stringMethod · 0.85
set_info_stringMethod · 0.85
option_tClass · 0.85

Calls 2

reserveMethod · 0.80
sizeMethod · 0.45

Tested by 1