@@ -19,13 +19,13 @@ std::vector<std::string> split(const char* text, std::string_view string_view =
19
19
std::vector<std::string> split (std::string_view text, std::string_view delims = " \t\n " );
20
20
21
21
// /@brief Returns 'input' with the first instance of 'search' replaced with 'replace'
22
- std::string replace_first (const std::string& input, const std::string& search, const std::string& replace);
22
+ std::string replace_first (std::string_view input, std::string_view search, std::string_view replace);
23
23
24
24
// /@brief Returns 'input' with all instances of 'search' replaced with 'replace'
25
- std::string replace_all (const std::string& input, const std::string& search, const std::string& replace);
25
+ std::string replace_all (std::string_view input, std::string_view search, std::string_view replace);
26
26
27
27
// /@brief Retruns true if str starts with prefix
28
- bool starts_with (const std::string& str, const std::string& prefix);
28
+ bool starts_with (const std::string& str, std::string_view prefix);
29
29
30
30
// /@brief Returns a std::string formatted using a printf-style format string
31
31
std::string string_fmt (const char * fmt, ...);
@@ -40,13 +40,13 @@ std::string vstring_fmt(const char* fmt, va_list args);
40
40
* would return "home/user/my_files/test.blif"
41
41
*/
42
42
template <typename Iter>
43
- std::string join (Iter begin, Iter end, std::string delim);
43
+ std::string join (Iter begin, Iter end, std::string_view delim);
44
44
45
45
template <typename Container>
46
- std::string join (Container container, std::string delim);
46
+ std::string join (Container container, std::string_view delim);
47
47
48
48
template <typename T>
49
- std::string join (std::initializer_list<T> list, std::string delim);
49
+ std::string join (std::initializer_list<T> list, std::string_view delim);
50
50
51
51
template <typename Container>
52
52
void uniquify (Container container);
@@ -70,7 +70,7 @@ double atod(const std::string& value);
70
70
*/
71
71
int get_file_line_number_of_last_opened_file ();
72
72
bool file_exists (const char * filename);
73
- bool check_file_name_extension (const std::string& file_name, const std::string& file_extension);
73
+ bool check_file_name_extension (std::string_view file_name, std::string_view file_extension);
74
74
75
75
extern std::string out_file_prefix;
76
76
@@ -83,7 +83,7 @@ std::vector<std::string> ReadLineTokens(FILE* InFile, int* LineNum);
83
83
* @brief Template join function implementation
84
84
*/
85
85
template <typename Iter>
86
- std::string join (Iter begin, Iter end, std::string delim) {
86
+ std::string join (Iter begin, Iter end, std::string_view delim) {
87
87
std::string joined_str;
88
88
for (auto iter = begin; iter != end; ++iter) {
89
89
joined_str += *iter;
@@ -95,12 +95,12 @@ std::string join(Iter begin, Iter end, std::string delim) {
95
95
}
96
96
97
97
template <typename Container>
98
- std::string join (Container container, std::string delim) {
98
+ std::string join (Container container, std::string_view delim) {
99
99
return join (std::begin (container), std::end (container), delim);
100
100
}
101
101
102
102
template <typename T>
103
- std::string join (std::initializer_list<T> list, std::string delim) {
103
+ std::string join (std::initializer_list<T> list, std::string_view delim) {
104
104
return join (list.begin (), list.end (), delim);
105
105
}
106
106
0 commit comments