Adding partial implementation of C++20 concepts and range functions for AZStd::span (#7102)

* Adding partial implementation of C++20 concepts and range functions for AZStd::span

The new concepts to discovered existing issues with the PathIterator and deque::iterator classes
PathIterator wasn't properly an input_iterator and therefore the Path classes weren't a range due to an incorrect const_iterator alias
The deque::iterator classes was missing the operator+ friend function that accepted a (ptrdiff_t, deque::iterator) to fulfill the random_access_iterator concepts

The AZStd implementations of (uninitialized_)copy(_n), (uninitialized_)move(_n) and (uninitialized_)file(_n) have been optimized to use memcpy and memset based on fulfilling the contiguous_iterator concept

Fixed invalid AZStd::vector inserts in FrameGraphExecuter.cpp and SliceditorEntityOwnershipService.cpp
The code was trying to copy the underlying addresses for vector<unique_ptr> to a vector<raw pointer> using insert, which it was doing by using memcpy.

relates to #6749

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Fixed the `fixed_vector` emplace function to not move initialized
elements using uninitialized_move.

This was causing initialized elements of the fixed_vector to be
overwritten with the element at the emplace position.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Fixed clang warnings about variables that are set, but never read

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Updated the `az_has_builtin_is_constant_evaluated` define to not have
"()" as is not a macro.

This helps prevent users from using `az_has_builtin_is_constant_evaluated`
define in a situation where they want to know if the function is being
evaluated in a compile time context.
In that case they need to use the `az_builtin_is_constant_evaluated()`
macro (which of course looks quite similiar) but does not have the word
"has" in it..

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Updated the AZStd span class to be C++20 compliant.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Changed phrase "DoesNotCompiles" to be more grammatically correct.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Added more unit test for AZStd span

Fixed an the the return type of the subspan template overload to account
for the source span having a dynamic extent.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Removed unused variable from span unit test.

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
This commit is contained in:
lumberyard-employee-dm
2022-01-24 17:09:08 -06:00
committed by GitHub
parent a3fbcae81f
commit f3e9e41f4f
45 changed files with 4998 additions and 1039 deletions
@@ -177,7 +177,6 @@ namespace AzToolsFramework
auto data = index.data(AssetBrowserModel::Roles::EntryRole);
if (data.canConvert<const AssetBrowserEntry*>())
{
[[maybe_unused]] bool isEnabled = (option.state & QStyle::State_Enabled) != 0;
QStyle* style = option.widget ? option.widget->style() : QApplication::style();
@@ -223,7 +222,6 @@ namespace AzToolsFramework
// sources with no children should be greyed out.
if (sourceEntry->GetChildCount() == 0)
{
isEnabled = false; // draw in disabled style.
actualPalette.setCurrentColorGroup(QPalette::Disabled);
}
}
@@ -285,7 +283,7 @@ namespace AzToolsFramework
initStyleOption(&optionV4, index);
optionV4.state &= ~(QStyle::State_HasFocus | QStyle::State_Selected);
if (m_assetBrowserFilerModel && m_assetBrowserFilerModel->GetStringFilter()
if (m_assetBrowserFilerModel && m_assetBrowserFilerModel->GetStringFilter()
&& !m_assetBrowserFilerModel->GetStringFilter()->GetFilterString().isEmpty())
{
displayString = RichTextHighlighter::HighlightText(displayString, m_assetBrowserFilerModel->GetStringFilter()->GetFilterString());
@@ -316,7 +314,7 @@ namespace AzToolsFramework
absoluteIconPath = AZ::IO::FixedMaxPath(AZ::Utils::GetEnginePath()) / TreeIconPathOneChild;
break;
}
[[maybe_unused]] bool pixmapLoadedSuccess = pixmap.load(absoluteIconPath.c_str());
[[maybe_unused]] bool pixmapLoadedSuccess = pixmap.load(absoluteIconPath.c_str());
AZ_Assert(pixmapLoadedSuccess, "Error loading Branch Icons in SearchEntryDelegate");
m_branchIcons[static_cast<EntryBranchType>(branchType)] = pixmap;
@@ -693,7 +693,12 @@ namespace AzToolsFramework
SliceEditorEntityOwnershipServiceNotificationBus::Broadcast(
&SliceEditorEntityOwnershipServiceNotifications::OnSaveStreamForGameBegin, stream, streamType, tempEntities);
sourceEntities.insert(sourceEntities.end(), tempEntities.begin(), tempEntities.end());
sourceEntities.reserve(sourceEntities.size() + tempEntities.size());
for (AZStd::unique_ptr<AZ::Entity>& tempEntity : tempEntities)
{
sourceEntities.emplace_back(tempEntity.release());
}
tempEntities = {};
// Add the root slice metadata entity so that we export any level components
sourceEntities.push_back(GetRootSlice()->GetMetadataEntity());