mirror of
https://github.com/ETLCPP/etl.git
synced 2026-11-09 14:49:53 +08:00
Update ETL_CONSTEXPR and C++14 desgination from type_def (#862)
* feat: make type_def constexpr * test: macro constexpr * test: implicit constexpr * test: get constexpr * refactor: remove constexpr from assignment * test: comparisons constexpr * fix: cpp11 support for constexpr get method * fix: c++11 issue with constexpr get reference * refactor: remove constexpr from the get methods * refactor: make assignment operators non-constexpr * refactor: remove constexpr from assignment and get * refactor: make other methods ETL_CONSTEXPR14 * test: operator preincrement * test: postincrement * test: predecrement constexpr * test: post decrement constexpr * fix: post decrement test * test: addition assignment constexpr * test: subtraction assignment constexpr * test: multiplication assignment operator * test: and assignment constexpr * test: or assignment constexpr * test: xor assignment constexpr * tet: left shift assignment constexpr * test: right shift assignment constexpr * test: operator modules assignment * style: revert personal clang-format changes * refactor: use free functions to test * refactor: remove constexpr non-constexpr test functions * style: remove erroneous tab
This commit is contained in:
parent
48c496cd44
commit
a8ca216f4e
@ -82,14 +82,14 @@ 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 ++();
|
||||
@ -97,14 +97,14 @@ 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 --();
|
||||
@ -112,164 +112,156 @@ namespace etl
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user