@@ -178,6 +178,12 @@ namespace pystring
178178 // / not found, the original string will be returned with two empty strings.
179179 // /
180180 void partition ( const std::string & str, const std::string & sep, std::vector< std::string > & result );
181+ inline std::vector< std::string > partition ( const std::string & str, const std::string & sep )
182+ {
183+ std::vector< std::string > result;
184+ partition ( str, sep, result );
185+ return result;
186+ }
181187
182188 // ////////////////////////////////////////////////////////////////////////////////////////////
183189 // / @brief Return a copy of the string with all occurrences of substring old replaced by new. If
@@ -211,6 +217,12 @@ namespace pystring
211217 // / not found, the original string will be returned with two empty strings.
212218 // /
213219 void rpartition ( const std::string & str, const std::string & sep, std::vector< std::string > & result );
220+ inline std::vector< std::string > rpartition ( const std::string & str, const std::string & sep )
221+ {
222+ std::vector< std::string > result;
223+ rpartition ( str, sep, result );
224+ return result;
225+ }
214226
215227 // ////////////////////////////////////////////////////////////////////////////////////////////
216228 // / @brief Return a copy of the string with trailing characters removed. If chars is "", whitespace
@@ -225,6 +237,12 @@ namespace pystring
225237 // / any whitespace string is a separator.
226238 // /
227239 void split ( const std::string & str, std::vector< std::string > & result, const std::string & sep = " " , int maxsplit = -1 );
240+ inline std::vector< std::string > split ( const std::string & str, const std::string & sep = " " , int maxsplit = -1 )
241+ {
242+ std::vector< std::string > result;
243+ split ( str, result, sep, maxsplit );
244+ return result;
245+ }
228246
229247 // ////////////////////////////////////////////////////////////////////////////////////////////
230248 // / @brief Fills the "result" list with the words in the string, using sep as the delimiter string.
@@ -234,12 +252,24 @@ namespace pystring
234252 // / any whitespace string is a separator.
235253 // /
236254 void rsplit ( const std::string & str, std::vector< std::string > & result, const std::string & sep = " " , int maxsplit = -1 );
255+ inline std::vector< std::string > rsplit ( const std::string & str, const std::string & sep = " " , int maxsplit = -1 )
256+ {
257+ std::vector< std::string > result;
258+ rsplit ( str, result, sep, maxsplit);
259+ return result;
260+ }
237261
238262 // ////////////////////////////////////////////////////////////////////////////////////////////
239263 // / @brief Return a list of the lines in the string, breaking at line boundaries. Line breaks
240264 // / are not included in the resulting list unless keepends is given and true.
241265 // /
242266 void splitlines ( const std::string & str, std::vector< std::string > & result, bool keepends = false );
267+ inline std::vector< std::string > splitlines ( const std::string & str, bool keepends = false )
268+ {
269+ std::vector< std::string > result;
270+ splitlines ( str, result, keepends);
271+ return result;
272+ }
243273
244274 // ////////////////////////////////////////////////////////////////////////////////////////////
245275 // / @brief Return True if string starts with the prefix, otherwise return False. With optional start,
0 commit comments