1- #pragma once
1+ #pragma once
22#include < string.h>
3+ #include < YY/Base/YY.h>
34
45namespace YY
56{
@@ -12,7 +13,7 @@ namespace YY
1213 {
1314 static void Constructor (_Type* _pFirst, _Type* _pLast)
1415 {
15- if constexpr (std::is_trivially_constructible<_Type>::value)
16+ if YY_CPP17_IF_CONSTEXPR (std::is_trivially_constructible<_Type>::value)
1617 {
1718 memset (_pFirst, 0 , (_pLast - _pFirst) * sizeof (*_pFirst));
1819 }
@@ -27,7 +28,7 @@ namespace YY
2728
2829 static void MoveConstructor (_Type* _pDst, _Type* _pFirst, _Type* _pLast)
2930 {
30- if constexpr (std::is_trivially_constructible<_Type>::value)
31+ if YY_CPP17_IF_CONSTEXPR (std::is_trivially_constructible<_Type>::value)
3132 {
3233 memcpy (_pDst, _pFirst, (_pLast - _pFirst) * sizeof (*_pFirst));
3334 }
@@ -47,7 +48,7 @@ namespace YY
4748
4849 static void CopyConstructor (_Type* _pDst, const _Type* _pFirst, const _Type* _pLast)
4950 {
50- if constexpr (std::is_trivially_constructible<_Type>::value)
51+ if YY_CPP17_IF_CONSTEXPR (std::is_trivially_constructible<_Type>::value)
5152 {
5253 memcpy (_pDst, _pFirst, (_pLast - _pFirst) * sizeof (*_pFirst));
5354 }
@@ -67,9 +68,9 @@ namespace YY
6768
6869 static void Destructor (_Type* _pFirst, _Type* _pLast)
6970 {
70- if constexpr (std::is_trivially_destructible<_Type>::value)
71+ if YY_CPP17_IF_CONSTEXPR (std::is_trivially_destructible<_Type>::value)
7172 {
72- // 如果是平坦的,那么什么也不做
73+ // 如果是平坦的,那么什么也不做
7374 return ;
7475 }
7576 else
@@ -88,7 +89,7 @@ namespace YY
8889
8990 static void Copy (_Type* _pDst, const _Type* _pFirst, const _Type* _pLast)
9091 {
91- if constexpr (std::is_trivially_copyable<_Type>::value)
92+ if YY_CPP17_IF_CONSTEXPR (std::is_trivially_copyable<_Type>::value)
9293 {
9394 memcpy (_pDst, _pFirst, (_pLast - _pFirst) * sizeof (*_pFirst));
9495 }
@@ -108,19 +109,19 @@ namespace YY
108109
109110 static void Move (_Type* _pDst, _Type* _pFirst, _Type* _pLast)
110111 {
111- if constexpr (std::is_trivially_copyable<_Type>::value)
112+ if YY_CPP17_IF_CONSTEXPR (std::is_trivially_copyable<_Type>::value)
112113 {
113114 memmove (_pDst, _pFirst, (_pLast - _pFirst) * sizeof (*_pFirst));
114115 }
115116 else
116117 {
117118 if (_pDst == _pFirst)
118119 {
119- // 完全一样,复制啥???
120+ // 完全一样,复制啥???
120121 }
121122 else if (_pFirst > _pDst && _pDst < _pLast)
122123 {
123- // 区域层叠,我们进行颠倒移动。
124+ // 区域层叠,我们进行颠倒移动。
124125 auto _pDstLast = _pDst + (_pLast - _pFirst);
125126
126127 while (_pFirst != _pLast)
0 commit comments