@@ -19,13 +19,13 @@ std::vector<std::string> split(const char* text, std::string_view string_view =
1919std::vector<std::string> split (std::string_view text, std::string_view delims = " \t\n " );
2020
2121// /@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);
2323
2424// /@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);
2626
2727// /@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);
2929
3030// /@brief Returns a std::string formatted using a printf-style format string
3131std::string string_fmt (const char * fmt, ...);
@@ -40,13 +40,13 @@ std::string vstring_fmt(const char* fmt, va_list args);
4040 * would return "home/user/my_files/test.blif"
4141 */
4242template <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);
4444
4545template <typename Container>
46- std::string join (Container container, std::string delim);
46+ std::string join (Container container, std::string_view delim);
4747
4848template <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);
5050
5151template <typename Container>
5252void uniquify (Container container);
@@ -70,7 +70,7 @@ double atod(const std::string& value);
7070 */
7171int get_file_line_number_of_last_opened_file ();
7272bool 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);
7474
7575extern std::string out_file_prefix;
7676
@@ -83,7 +83,7 @@ std::vector<std::string> ReadLineTokens(FILE* InFile, int* LineNum);
8383 * @brief Template join function implementation
8484 */
8585template <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) {
8787 std::string joined_str;
8888 for (auto iter = begin; iter != end; ++iter) {
8989 joined_str += *iter;
@@ -95,12 +95,12 @@ std::string join(Iter begin, Iter end, std::string delim) {
9595}
9696
9797template <typename Container>
98- std::string join (Container container, std::string delim) {
98+ std::string join (Container container, std::string_view delim) {
9999 return join (std::begin (container), std::end (container), delim);
100100}
101101
102102template <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) {
104104 return join (list.begin (), list.end (), delim);
105105}
106106
0 commit comments