• R/O
  • SSH
  • HTTPS

eirrepo: Commit


Commit MetaInfo

Revision453 (tree)
Time2022-02-24 22:01:10
Authorquiret

Log Message

- adjusted some parameters to prevent unnecessary copies
- improvement regarding rejection of const-references to containers in modifying functions

Change Summary

Incremental Difference

--- common/sdk/UniqueIterate.h (revision 452)
+++ common/sdk/UniqueIterate.h (revision 453)
@@ -282,7 +282,7 @@
282282 // re-entering of containers, being better performance for local-iteration-purposes.
283283 template <typename itemType, typename callbackType, typename... containerTypes, typename... excludeContainerTypes>
284284 requires ( sizeof...( containerTypes ) > 0 && std::is_invocable <callbackType, itemType&>::value )
285-AINLINE void uniqueIterateTuple( callbackType&& cb, const std::tuple <containerTypes...>& containers, const std::tuple <excludeContainerTypes...>& exclude_containers = std::tuple() )
285+AINLINE void uniqueIterateTuple( callbackType&& cb, std::tuple <containerTypes...> containers, const std::tuple <excludeContainerTypes...>& exclude_containers = std::tuple() )
286286 {
287287 size_t container_idx = 0;
288288
@@ -311,7 +311,7 @@
311311 return ( containerContains( container, item ) );
312312 };
313313
314- return std::apply( [&]( const containerTypes&... args ) LAINLINE { return ( _container_find( args ) || ... ); }, containers );
314+ return std::apply( [&]( const containerTypes&... args ) LAINLINE { return ( _container_find( args ) || ... ); }, std::move( containers ) );
315315 };
316316
317317 auto iterate_container = [&]( const auto& container ) LAINLINE
@@ -329,7 +329,7 @@
329329 container_idx++;
330330 };
331331
332- std::apply( [&] ( const containerTypes&... args ) LAINLINE { ( iterate_container( args ), ... ); }, containers );
332+ std::apply( [&] ( containerTypes&&... args ) LAINLINE { ( iterate_container( args ), ... ); }, std::move( containers ) );
333333 }
334334
335335 template <typename itemType, typename callbackType, typename... containerTypes>
@@ -348,7 +348,7 @@
348348 }
349349
350350 template <typename findItemType, typename putItemType, typename... containerTypes>
351- requires ( sizeof...( containerTypes ) > 0 )
351+ requires ( sizeof...( containerTypes ) > 0 && ( std::is_const <containerTypes>::value || ... ) == false )
352352 AINLINE void replaceInContainer( const findItemType& oldval, const putItemType& newval, containerTypes&&... containers )
353353 {
354354 auto _replace_lambda = [&]( auto& container ) LAINLINE
@@ -388,7 +388,7 @@
388388 }
389389
390390 template <typename itemType, typename... containerTypes>
391- requires ( sizeof...( containerTypes ) > 0 )
391+ requires ( sizeof...( containerTypes ) > 0 && ( std::is_const <containerTypes>::value || ... ) == false )
392392 AINLINE void removeFromContainer( const itemType& findval, containerTypes&&... containers )
393393 {
394394 auto _remove_lambda = [&]( auto& container ) LAINLINE
Show on old repository browser