Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ETL_CONSTEXPR and C++14 desgination from type_def #862

Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
adb50a6
feat: make type_def constexpr
drewr95 Mar 12, 2024
0617696
test: macro constexpr
drewr95 Mar 12, 2024
089c122
test: implicit constexpr
drewr95 Mar 12, 2024
f1d4ef9
test: get constexpr
drewr95 Mar 12, 2024
35d2226
refactor: remove constexpr from assignment
drewr95 Mar 12, 2024
014dc5d
test: comparisons constexpr
drewr95 Mar 12, 2024
11c92d5
fix: cpp11 support for constexpr get method
drewr95 Mar 12, 2024
c9af0a2
fix: c++11 issue with constexpr get reference
drewr95 Mar 13, 2024
f42e65a
refactor: remove constexpr from the get methods
drewr95 Mar 13, 2024
276c934
refactor: make assignment operators non-constexpr
drewr95 Mar 13, 2024
a455206
Merge branch 'pull-request/#861-Implement-Constexpr-Strong-Typedef' i…
drewr95 Mar 13, 2024
e85f40f
refactor: remove constexpr from assignment and get
drewr95 Mar 13, 2024
e973f96
refactor: make other methods ETL_CONSTEXPR14
drewr95 Mar 13, 2024
0f59de2
test: operator preincrement
drewr95 Mar 13, 2024
c10bd4a
test: postincrement
drewr95 Mar 13, 2024
7617849
test: predecrement constexpr
drewr95 Mar 13, 2024
47e3b42
test: post decrement constexpr
drewr95 Mar 13, 2024
67abdb7
fix: post decrement test
drewr95 Mar 13, 2024
71e9af8
test: addition assignment constexpr
drewr95 Mar 13, 2024
220e4f7
test: subtraction assignment constexpr
drewr95 Mar 13, 2024
155c3b5
test: multiplication assignment operator
drewr95 Mar 13, 2024
9fb16ee
test: and assignment constexpr
drewr95 Mar 13, 2024
79ff8b4
test: or assignment constexpr
drewr95 Mar 13, 2024
8dec2e1
test: xor assignment constexpr
drewr95 Mar 13, 2024
9a39c75
tet: left shift assignment constexpr
drewr95 Mar 13, 2024
8316556
test: right shift assignment constexpr
drewr95 Mar 13, 2024
b6ac7f0
test: operator modules assignment
drewr95 Mar 13, 2024
aa56627
style: revert personal clang-format changes
drewr95 Mar 13, 2024
0fdf698
refactor: use free functions to test
drewr95 Mar 13, 2024
a7a8589
refactor: remove constexpr non-constexpr test functions
drewr95 Mar 13, 2024
89282b5
style: remove erroneous tab
drewr95 Mar 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 26 additions & 34 deletions include/etl/type_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,194 +82,186 @@ namespace etl
}

//*********************************************************************
type_def& operator ++()
ETL_CONSTEXPR14 type_def& operator ++()
{
++value;
return *this;
}

//*********************************************************************
type_def operator ++(int)
ETL_CONSTEXPR14 type_def operator ++(int)
{
type_def temp(*this);
type_def::operator ++();
return temp;
}

//*********************************************************************
type_def& operator --()
ETL_CONSTEXPR14 type_def& operator --()
{
--value;
return *this;
}

//*********************************************************************
type_def operator --(int)
ETL_CONSTEXPR14 type_def operator --(int)
{
type_def temp(*this);
type_def::operator --();
return temp;
}

//*********************************************************************
type_def& operator +=(TValue rhs)
ETL_CONSTEXPR14 type_def& operator +=(TValue rhs)
{
value += rhs;
return *this;
}

//*********************************************************************
type_def& operator +=(const type_def& rhs)
ETL_CONSTEXPR14 type_def& operator +=(const type_def& rhs)
{
value += rhs.value;
return *this;
}

//*********************************************************************
type_def& operator -=(TValue rhs)
ETL_CONSTEXPR14 type_def& operator -=(TValue rhs)
{
value -= rhs;
return *this;
}

//*********************************************************************
type_def& operator -=(const type_def& rhs)
ETL_CONSTEXPR14 type_def& operator -=(const type_def& rhs)
{
value -= rhs.value;
return *this;
}

//*********************************************************************
type_def& operator *=(TValue rhs)
ETL_CONSTEXPR14 type_def& operator *=(TValue rhs)
{
value *= rhs;
return *this;
}

//*********************************************************************
type_def& operator *=(const type_def& rhs)
ETL_CONSTEXPR14 type_def& operator *=(const type_def& rhs)
{
value *= rhs.value;
return *this;
}

//*********************************************************************
type_def& operator /=(TValue rhs)
ETL_CONSTEXPR14 type_def& operator /=(TValue rhs)
{
value /= rhs;
return *this;
}

//*********************************************************************
type_def& operator /=(const type_def& rhs)
ETL_CONSTEXPR14 type_def& operator /=(const type_def& rhs)
{
value /= rhs.value;
return *this;
}

//*********************************************************************
type_def& operator %=(TValue rhs)
ETL_CONSTEXPR14 type_def& operator %=(TValue rhs)
{
value %= rhs;
return *this;
}

//*********************************************************************
type_def& operator %=(const type_def& rhs)
ETL_CONSTEXPR14 type_def& operator %=(const type_def& rhs)
{
value %= rhs.value;
return *this;
}

//*********************************************************************
type_def& operator &=(TValue rhs)
ETL_CONSTEXPR14 type_def& operator &=(TValue rhs)
{
value &= rhs;
return *this;
}

//*********************************************************************
type_def& operator &=(const type_def& rhs)
ETL_CONSTEXPR14 type_def& operator &=(const type_def& rhs)
{
value &= rhs.value;
return *this;
}

//*********************************************************************
type_def& operator |=(TValue rhs)
ETL_CONSTEXPR14 type_def& operator |=(TValue rhs)
{
value |= rhs;
return *this;
}

//*********************************************************************
type_def& operator |=(const type_def& rhs)
ETL_CONSTEXPR14 type_def& operator |=(const type_def& rhs)
{
value |= rhs.value;
return *this;
}

//*********************************************************************
type_def& operator ^=(TValue rhs)
ETL_CONSTEXPR14 type_def& operator ^=(TValue rhs)
{
value ^= rhs;
return *this;
}

//*********************************************************************
type_def& operator ^=(const type_def& rhs)
ETL_CONSTEXPR14 type_def& operator ^=(const type_def& rhs)
{
value ^= rhs.value;
return *this;
}

//*********************************************************************
type_def& operator <<=(TValue rhs)
ETL_CONSTEXPR14 type_def& operator <<=(TValue rhs)
{
value <<= rhs;
return *this;
}

//*********************************************************************
type_def& operator >>=(TValue rhs)
ETL_CONSTEXPR14 type_def& operator >>=(TValue rhs)
{
value >>= rhs;
return *this;
}

//*********************************************************************
ETL_CONSTEXPR type_def& operator =(TValue rhs)
ETL_CONSTEXPR14 type_def& operator =(TValue rhs)
{
value = rhs;
return *this;
}

//*********************************************************************
ETL_CONSTEXPR type_def& operator =(const type_def& rhs)
ETL_CONSTEXPR14 type_def& operator =(const type_def& rhs)
{
value = rhs.value;
return *this;
}

//*********************************************************************
ETL_CONSTEXPR TValue& get()
ETL_CONSTEXPR14 TValue& get()
{
return value;
}

#if ETL_USING_CPP14
//*********************************************************************
ETL_CONSTEXPR const TValue& get() const
ETL_CONSTEXPR14 const TValue& get() const
{
return value;
}
#else
//*********************************************************************
const TValue& get() const
{
return value;
}
#endif // ETL_USING_CPP14

//*********************************************************************
friend ETL_CONSTEXPR bool operator <(const type_def& lhs, const type_def& rhs)
Expand Down
Loading