From f987d2a28748c821e6dcb5d32ea898853d9c58f5 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Wed, 29 Sep 2021 18:49:27 +0100 Subject: [PATCH] Fixes to byte_stream_reader for const data --- include/etl/byte_stream.h | 12 ++++++++++++ include/etl/span.h | 5 ++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/include/etl/byte_stream.h b/include/etl/byte_stream.h index 45fd3718..164c70b4 100644 --- a/include/etl/byte_stream.h +++ b/include/etl/byte_stream.h @@ -374,6 +374,18 @@ namespace etl { } + //*************************************************************************** + /// Construct from const array. + //*************************************************************************** + template + byte_stream_reader(const T(&begin_)[Size], etl::endian buffer_endianness_ = etl::endian::big) + : pdata(begin_) + , pcurrent(begin_) + , length(begin_ + (Size * sizeof(T))) + , buffer_endianness(buffer_endianness_) + { + } + //*************************************************************************** /// Read a value from the stream. //*************************************************************************** diff --git a/include/etl/span.h b/include/etl/span.h index 127e0415..d78a9460 100644 --- a/include/etl/span.h +++ b/include/etl/span.h @@ -41,10 +41,9 @@ SOFTWARE. #include "array.h" ///\defgroup span span -/// A wrapper for arrays ///\ingroup containers -#if ETL_USING_STL +#if ETL_CPP11_SUPPORTED && ETL_USING_STL #include #endif @@ -93,7 +92,7 @@ namespace etl { } -#if ETL_USING_STL +#if ETL_CPP11_SUPPORTED && ETL_USING_STL //************************************************************************* /// Construct from std::array. //*************************************************************************