Last active
November 17, 2020 11:28
-
-
Save tshev/a11e4efeddc67d0574130a0ca0094f1d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sgl/sgl.h> | |
#include <iostream> | |
#include <vector> | |
#include <string> | |
int main() { | |
sgl::v1::mmap<char> text("text.txt"); | |
char* text_first = std::begin(text); | |
char* text_last = std::end(text); | |
size_t lines_count = std::count(text_first, text_last, '\n'); | |
std::vector<std::string_view> strings(lines_count); | |
sgl::v1::transform_splits(text_first, text_last, '\n', std::begin(strings), sgl::v1::f::construct<std::string_view>()); | |
std::sort(std::begin(strings), std::end(strings)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment