Commit 5f7b7d77 authored by Ing. Jan Trávníček's avatar Ing. Jan Trávníček

clang-tidy: pass shared_ptrs by const ref

moving is actually more expensive for shared_ptrs
parent 6f27f46d
......@@ -46,8 +46,8 @@ private:
ext::vector < std::shared_ptr < LazyValue > > m_abstractions;
public:
explicit PackingAbstractionImpl ( ext::vector < std::shared_ptr < abstraction::OperationAbstraction > > abstractions ) {
std::transform ( abstractions.begin ( ), abstractions.end ( ), std::back_inserter ( m_abstractions ), [ ] ( const std::shared_ptr < abstraction::OperationAbstraction > & abstraction ) { return std::make_shared < LazyValue > ( std::move ( abstraction ) ); } );
explicit PackingAbstractionImpl ( const ext::vector < std::shared_ptr < abstraction::OperationAbstraction > > & abstractions ) {
std::transform ( abstractions.begin ( ), abstractions.end ( ), std::back_inserter ( m_abstractions ), [ ] ( const std::shared_ptr < abstraction::OperationAbstraction > & abstraction ) { return std::make_shared < LazyValue > ( abstraction ); } );
}
void setInnerConnection ( size_t sourceId, size_t targetId, size_t paramPosition ) {
......@@ -79,7 +79,7 @@ public:
m_connections [ sourceId ].push_back ( ConnectionTarget { targetId, paramPosition } );
}
PackingAbstraction ( ext::vector < std::shared_ptr < abstraction::OperationAbstraction > > abstractions, size_t resultId ) : PackingAbstractionImpl ( std::move ( abstractions ) ), m_resultId ( resultId ) {
PackingAbstraction ( const ext::vector < std::shared_ptr < abstraction::OperationAbstraction > > & abstractions, size_t resultId ) : PackingAbstractionImpl ( abstractions ), m_resultId ( resultId ) {
}
private:
......
......@@ -26,7 +26,7 @@ namespace {
abstractions.push_back ( std::make_shared < abstraction::WrapperAbstraction < std::string && > > ( rawParserAbstractionFinder ) );
std::shared_ptr < abstraction::PackingAbstraction < 1 > > res = std::make_shared < abstraction::PackingAbstraction < 1 > > ( std::move ( abstractions ), 1 );
std::shared_ptr < abstraction::PackingAbstraction < 1 > > res = std::make_shared < abstraction::PackingAbstraction < 1 > > ( abstractions, 1 );
res->setInnerConnection ( 0, 1, 0 );
res->setOuterConnection ( 0, 0, 0 );
......
......@@ -21,7 +21,7 @@ namespace {
abstractions.push_back ( abstraction::Registry::getAlgorithmAbstraction ( "cli::builtin::WriteFile", templateParams, paramTypes, paramTypeQualifiers, category ) );
std::shared_ptr < abstraction::PackingAbstraction < 2 > > res = std::make_shared < abstraction::PackingAbstraction < 2 > > ( std::move ( abstractions ), 1 );
std::shared_ptr < abstraction::PackingAbstraction < 2 > > res = std::make_shared < abstraction::PackingAbstraction < 2 > > ( abstractions, 1 );
res->setInnerConnection ( 0, 1, 1 );
res->setOuterConnection ( 0, 1, 0 ); // filename
res->setOuterConnection ( 1, 0, 0 ); // data
......
......@@ -26,7 +26,7 @@ namespace {
abstractions.push_back ( std::make_shared < abstraction::WrapperAbstraction < std::string && > > ( stringParserAbstractionFinder ) );
std::shared_ptr < abstraction::PackingAbstraction < 1 > > res = std::make_shared < abstraction::PackingAbstraction < 1 > > ( std::move ( abstractions ), 1 );
std::shared_ptr < abstraction::PackingAbstraction < 1 > > res = std::make_shared < abstraction::PackingAbstraction < 1 > > ( abstractions, 1 );
res->setInnerConnection ( 0, 1, 0 );
res->setOuterConnection ( 0, 0, 0 );
......
......@@ -21,7 +21,7 @@ namespace {
abstractions.push_back ( abstraction::Registry::getAlgorithmAbstraction ( "cli::builtin::WriteFile", templateParams, paramTypes, paramTypeQualifiers, category ) );
std::shared_ptr < abstraction::PackingAbstraction < 2 > > res = std::make_shared < abstraction::PackingAbstraction < 2 > > ( std::move ( abstractions ), 1 );
std::shared_ptr < abstraction::PackingAbstraction < 2 > > res = std::make_shared < abstraction::PackingAbstraction < 2 > > ( abstractions, 1 );
res->setInnerConnection ( 0, 1, 1 );
res->setOuterConnection ( 0, 1, 0 ); // filename
res->setOuterConnection ( 1, 0, 0 ); // data
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment