Created
January 12, 2019 12:39
-
-
Save eao197/58ebecdac294281c3d2b0c1c781337c5 to your computer and use it in GitHub Desktop.
More or less valid C++ syntax for aensidhe example
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
// Source: https://aensidhe.ru/blog/readonlyspan-readonlysequence-c++ | |
template<class TElement> | |
class Parser { | |
private: | |
const IMsgPackParser<TElement> elementParser_; | |
template<template<class> Container> | |
void Read(const Container<byte> & source, Span<TElement> & array, size_t & readSize) { | |
for(size_t i = 0u; i != array.Length(); ++i) { | |
size_t temp; | |
array[i] = elementParser_.Parse(source.Slice(readSize), temp); | |
readSize += temp; | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment