listings/utf8-decoder.cpp
std::vector<codepoint> decode(const std::vector<byte> &bytes) {
  // Initialize iterators pointing to start and end of bytes.
  auto iter = bytes.cbegin();
  auto end = bytes.cend();

  // Decode codepoints until there are no more bytes.
  std::vector<codepoint> codepoints = {};
  while (iter != end) {
    auto cp = next_codepoint(iter, end);
    codepoints.push_back(*cp);
  }

  return codepoints;
}
// Pass in a vector of bytes to decode into codepoints.
Pass in a vector of bytes to decode into codepoints.
Pass in a vector of bytes to decode into codepoints .
std::vector<codepoint> decode(const std::vector<byte> &bytes) {
  auto iter = bytes.cbegin();
  auto end = bytes.cend();
  std::vector<codepoint> codepoints = {};
  while (iter != end) {
    auto cp = next_codepoint(iter, end);
    codepoints.push_back(*cp);
  }
  return codepoints;
}
std :: vector < codepoint > decode ( const std :: vector < byte > & bytes ) { auto iter = bytes . cbegin ( ) ; auto end = bytes . cend ( ) ; std :: vector < codepoint > codepoints = { } ; while ( iter != end ) { auto cp = next_codepoint ( iter , end ) ; codepoints . push_back ( * cp ) ; } return codepoints ; }
Pass in a vector of bytes to decode into codepoints.
Pass in a vector of bytes to decode into codepoints .
// Initialize iterators pointing to start and end of bytes. // Decode codepoints until there are no more bytes.