From feff9d1d9757c4a902c8a7d0bdc88e8fc881f113 Mon Sep 17 00:00:00 2001 From: yhirose Date: Wed, 11 Mar 2015 14:10:59 -0400 Subject: [PATCH] Updated documentation. --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 00f3a03..9e220e9 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,11 @@ struct SemanticValue { std::string name; // Definition name for the sematic value const char* s; // Token start for the semantic value size_t n; // Token length for the semantic value + + // Utility method + template T& get(); + template const T& get() const; + std::string str() const; }; struct SemanticValues : protected std::vector @@ -96,6 +101,17 @@ struct SemanticValues : protected std::vector const char* s; // Token start size_t n; // Token length size_t choice; // Choice number (0 based index) + + using std::vector::size; + using std::vector::operator[]; + using std::vector::begin; + using std::vector::end; + // NOTE: There are more std::vector methods available... + + // Transform the semantice values vector to another vector + template auto map(size_t beg, size_t end, F f) const -> vector::type>; + template auto map(F f) const -> vector::type>; + template auto map(size_t beg = 0, size_t end = -1) const -> vector; } ```