@@ -43,6 +43,25 @@ namespace py = pybind11;
4343namespace disjointPaths {
4444
4545
46+ template <class T =char >
47+ std::vector<std::string> split (
48+ std::string inputString, T delim) {
49+ size_t occurence = 0 ;
50+ size_t newOccurence = 0 ;
51+ std::vector<std::string> strings;
52+ while (newOccurence < inputString.size ()) {
53+ newOccurence = std::min (inputString.find_first_of (delim, occurence),
54+ inputString.size ());
55+
56+ std::string newString (inputString, occurence, newOccurence - occurence);
57+ strings.push_back (newString);
58+ newOccurence = newOccurence + 1 ;
59+ occurence = newOccurence;
60+ }
61+
62+ return strings;
63+ }
64+
4665
4766template <class T =size_t >
4867std::vector<std::vector<T>> readLines (std::string inputFileName, char delim) {
@@ -86,25 +105,6 @@ std::vector<std::vector<T>> readLines(std::string inputFileName, char delim) {
86105}
87106
88107
89- template <class T =char >
90- std::vector<std::string> split (
91- std::string inputString, T delim) {
92- size_t occurence = 0 ;
93- size_t newOccurence = 0 ;
94- std::vector<std::string> strings;
95- while (newOccurence < inputString.size ()) {
96- newOccurence = std::min (inputString.find_first_of (delim, occurence),
97- inputString.size ());
98-
99- std::string newString (inputString, occurence, newOccurence - occurence);
100- strings.push_back (newString);
101- newOccurence = newOccurence + 1 ;
102- occurence = newOccurence;
103- }
104-
105- return strings;
106- }
107-
108108
109109 inline void writeOutputToFile (const std::vector<std::vector<size_t >>& paths,std::string outputFileName){
110110
0 commit comments