Add missing include

This commit is contained in:
halx99 2021-04-24 23:15:32 +08:00
parent 3f0c9baef7
commit ed4433f487
2 changed files with 20 additions and 0 deletions

View File

@ -25,3 +25,22 @@
} }
``` ```
* **fast_split.hpp**: Yeah, idea same with ```fast_csv.hpp``` * **fast_split.hpp**: Yeah, idea same with ```fast_csv.hpp```
```cpp
std::string buffer = read_file("xxx.csv");
fastl::fast_split_of(buffer.c_str(), buffer.size(), "\r\n", [&](const char* v_start, const char* v_end, int /*delimChar*/) {
// do somethings, store or parse the column value
// std::string value(v_start, v_end);
});
```
or
```cpp
std::string buffer = read_file("xxx.csv");
if(!buffer.empty()) {
fastl::fast_split_of(&buffer.front(), buffer.size(), "\r\n", [&](char* v_start, char* v_end, int /*delimChar*/) {
// if item is int or double, is more Memory Efficient parse it directly
char endch = *v_end; // store the last char in the streaming
*v_end = '\0';
int key = atoi(v_start); // parse int value directly
*v_end = endch; // restore rthe last char in the stream
});
```

View File

@ -27,6 +27,7 @@
#define SIMDSOFT_FAST_SPLIT_HPP #define SIMDSOFT_FAST_SPLIT_HPP
#include <string.h> #include <string.h>
#include <string> #include <string>
#include <vector>
namespace fastl { namespace fastl {
namespace internal { namespace internal {