Skip to content

Commit 7617de0

Browse files
committed
Avoid copies of Source
1 parent 25b7240 commit 7617de0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

nestkernel/source_table.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -485,10 +485,12 @@ SourceTable::find_first_source( const size_t tid,
485485
const SourceIter begin = sources_[ tid ][ syn_id ].begin();
486486
const SourceIter end = sources_[ tid ][ syn_id ].end();
487487

488+
Source value {snode_id, true};
489+
488490
if ( isCompressedEnabled )
489491
{
490492
// binary search in sorted sources
491-
SourceIter it = std::lower_bound( begin, end, Source( snode_id, true ) );
493+
SourceIter it = std::lower_bound( begin, end, value );
492494

493495
// source found by binary search could be disabled, iterate through
494496
// sources until a valid one is found
@@ -525,7 +527,7 @@ SourceTable::find_first_source( const size_t tid,
525527
return { iter != last, iter };
526528
};
527529
size_t pos = 0;
528-
auto res = nth_equal( begin, end, Source( snode_id, true ), pos );
530+
auto res = nth_equal( begin, end, value, pos );
529531
if ( !res.first )
530532
{
531533
return invalid_index;
@@ -540,7 +542,7 @@ SourceTable::find_first_source( const size_t tid,
540542
return lcid;
541543
}
542544
++pos;
543-
res = nth_equal( std::next( res.second ), end, Source( snode_id, true ), pos );
545+
res = nth_equal( std::next( res.second ), end, value, pos );
544546
}
545547
return invalid_index;
546548
}

0 commit comments

Comments
 (0)