Make etl::array_view immutable by default

This commit is contained in:
John Wellbelove 2020-04-10 11:20:01 +01:00
parent 4e750272ba
commit 7df68346aa
9 changed files with 25 additions and 21 deletions

1
.vs/.gitignore vendored
View File

@ -1 +0,0 @@
/slnx.sqlite

View File

@ -1,3 +0,0 @@
{
"CurrentProjectSetting": "x86-Debug"
}

View File

@ -1,10 +0,0 @@
{
"ExpandedNodes": [
"",
"\\include",
"\\include\\etl",
"\\test"
],
"SelectedNode": "\\test\\test_to_string.cpp",
"PreviewInSolutionExplorer": false
}

View File

@ -101,15 +101,23 @@ namespace etl
typedef T value_type;
typedef size_t size_type;
typedef T& reference;
typedef const T& const_reference;
typedef T* pointer;
typedef const T* const_pointer;
typedef T* iterator;
typedef const T* const_iterator;
typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
typedef ETL_OR_STD::reverse_iterator<const_iterator> const_reverse_iterator;
#if defined(ETL_ARRAY_VIEW_IS_MUTABLE)
typedef T* pointer;
typedef T& reference;
typedef T* iterator;
typedef ETL_OR_STD::reverse_iterator<iterator> reverse_iterator;
#else
typedef const_pointer pointer;
typedef const_reference reference;
typedef const_pointer iterator;
typedef const_reverse_iterator reverse_iterator;
#endif
//*************************************************************************
/// Default constructor.
//*************************************************************************
@ -369,6 +377,7 @@ namespace etl
mend = etl::addressof(*begin_) + size_;
}
#if defined(ETL_ARRAY_VIEW_IS_MUTABLE)
//*************************************************************************
/// Returns a reference to the indexed value.
//*************************************************************************
@ -376,6 +385,7 @@ namespace etl
{
return mbegin[i];
}
#endif
//*************************************************************************
/// Returns a const reference to the indexed value.
@ -385,6 +395,7 @@ namespace etl
return mbegin[i];
}
#if defined(ETL_ARRAY_VIEW_IS_MUTABLE)
//*************************************************************************
/// Returns a reference to the indexed value.
//*************************************************************************
@ -394,6 +405,7 @@ namespace etl
ETL_ASSERT(i < size(), ETL_ERROR(array_view_bounds));
return mbegin[i];
}
#endif
//*************************************************************************
/// Returns a const reference to the indexed value.

View File

@ -38,7 +38,7 @@ SOFTWARE.
///\ingroup utilities
#define ETL_VERSION_MAJOR 17
#define ETL_VERSION_MINOR 5
#define ETL_VERSION_MINOR 6
#define ETL_VERSION_PATCH 0
#define ETL_VERSION ETL_STRINGIFY(ETL_VERSION_MAJOR) "." ETL_STRINGIFY(ETL_VERSION_MINOR) "." ETL_STRINGIFY(ETL_VERSION_PATCH)
#define ETL_VERSION_W ETL_STRINGIFY(ETL_VERSION_MAJOR) L"." ETL_STRINGIFY(ETL_VERSION_MINOR) L"." ETL_STRINGIFY(ETL_VERSION_PATCH)

View File

@ -1,6 +1,6 @@
{
"name": "Embedded Template Library",
"version": "17.5.0",
"version": "17.6.0",
"authors": {
"name": "John Wellbelove",
"email": "john.wellbelove@etlcpp.com"

View File

@ -1,5 +1,5 @@
name=Embedded Template Library
version=17.5.0
version=17.6.0
author= John Wellbelove <john.wellbelove@etlcpp.com>
maintainer=John Wellbelove <john.wellbelove@etlcpp.com>
license=MIT

View File

@ -1,3 +1,8 @@
===============================================================================
17.6.0
etl::array_view is non-mutable by default.
Mutable functionality is enabled by defining ETL_ARRAY_VIEW_IS_MUTABLE
===============================================================================
17.5.0
Modified etl::message_packet to allow default construction, copy/move construction

View File

@ -39,6 +39,7 @@ SOFTWARE.
#define ETL_IDEQUE_REPAIR_ENABLE
#define ETL_IN_UNIT_TEST
#define ETL_DEBUG_COUNT
#define ETL_ARRAY_VIEW_IS_MUTABLE
#define ETL_MESSAGE_TIMER_USE_ATOMIC_LOCK
#define ETL_CALLBACK_TIMER_USE_ATOMIC_LOCK