Import Geant4 9.6.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 17:01:34 +02:00
parent b1eb5424d2
commit e2d2f9810a
10384 changed files with 698580 additions and 628834 deletions
+44
View File
@@ -44,6 +44,50 @@ inline std::vector<std::string> words(const std::string& a_string,const std::str
return v;
}
inline void words(const std::string& a_string,
const std::string& a_sep,bool a_take_empty,
//output :
unsigned int& a_wn,
std::string::size_type* a_wps,
std::string::size_type* a_wls){
//used to optimize inlib::match().
a_wn = 0;
if(a_string.empty()) return;
std::string::size_type lim = (a_take_empty?0:1);
if(a_sep.empty()) {
//a_words.push_back(a_string);
a_wps[a_wn] = 0;
a_wls[a_wn] = a_string.length();
a_wn++;
} else {
std::string::size_type l = a_string.length();
std::string::size_type llimiter = a_sep.length();
std::string::size_type pos = 0;
while(true) {
std::string::size_type index = a_string.find(a_sep,pos);
if(index==std::string::npos){ // Last word.
if((l-pos)>=lim) {
//a_words.push_back(a_string.substr(pos,l-pos));
a_wps[a_wn] = pos;
a_wls[a_wn] = l-pos;
a_wn++;
}
break;
} else {
// abcxxxef
// 0 3 67
if((index-pos)>=lim) {
//a_words.push_back(a_string.substr(pos,index-pos));
a_wps[a_wn] = pos;
a_wls[a_wn] = index-pos;
a_wn++;
}
pos = index + llimiter;
}
}
}
}
}
#endif