Commit afb926bb7ad252d7f4808d186d096fd8fcecd52c

Authored by Jordi Inglada
1 parent 217e26c2
Exists in master

Add readme

Showing 2 changed files with 21 additions and 1 deletions   Show diff stats
README.org 0 → 100644
... ... @@ -0,0 +1,21 @@
  1 +~cesbio-utils~ is a header-only C++ library with small utilities for:
  2 +- string manipulation
  3 +- text file parsing
  4 +- etc.
  5 +
  6 +which can be useful for [[http://jordiinglada.net/wp/2015/03/25/scripting-in-c-2/][rapid prototyping and scripting in C++]].
  7 +
  8 +The library is not optimized for speed or memory, but rather for writing simple code. For instance, ~std::vector~ is used as a return value instead of passing ~std::vector&~ as an output parameter. Although move semantics in modern C++ should supress the copy of the return value, some programmers will see that as a heresy. We prefer being able to write
  9 +
  10 +#+BEGIN_SRC C++
  11 +auto lines = cbutils::seq::tail(cbutils::file::readlines(input_file));
  12 +#+END_SRC
  13 +
  14 +rather than
  15 +
  16 +#+BEGIN_SRC C++
  17 +std::vector<std::string> lines{};
  18 +cbutils::file::readlines(input_file, lines);
  19 +std::vector<std::string> lines_without_first_line{};
  20 +cbutils::seq::tail(lines, lines_without_first_line);
  21 +#+END_SRC
... ...
include/cbutils.h
... ... @@ -59,7 +59,6 @@ template &lt;typename Seq&gt; Seq tail(const Seq&amp; s)
59 59 std::advance(head,1);
60 60 std::copy(head, std::end(s), std::back_inserter(result));
61 61 return result;
62   -
63 62 }
64 63 }// end ns seq
65 64  
... ...