コード例 #1
0
ファイル: fromstring.hpp プロジェクト: artas360/pythran
 types::ndarray<typename types::numpy_type<dtype>::type, 1>
 fromstring(types::str const &string, dtype d, long count,
            types::str const &sep)
 {
   if (sep) {
     types::list<typename types::numpy_type<dtype>::type> res(0);
     if (count < 0)
       count = std::numeric_limits<long>::max();
     else
       res.reserve(count);
     size_t current;
     size_t next = -1;
     long numsplit = 0;
     do {
       current = next + 1;
       next = string.find_first_of(sep, current);
       typename types::numpy_type<dtype>::type item;
       std::istringstream iss(
           string.substr(current, next - current).get_data());
       iss >> item;
       res.push_back(item);
     } while (next != types::str::npos && ++numsplit < count);
     return {res};
   } else {
     if (count < 0)