Return reference rather than copy

No need to return a const copy by default in GetItems().  The const
reference will be faster.  Thanks to @GyrosGeier for the suggestion
This commit is contained in:
Seth Hillbrand 2022-12-16 10:47:01 -08:00
parent b4e806e4b2
commit 66e9d5c61c
3 changed files with 4 additions and 4 deletions

View File

@ -146,7 +146,7 @@ public:
m_items.push_back( aItem ); m_items.push_back( aItem );
} }
const std::list<CN_ITEM*> GetItems() const const std::list<CN_ITEM*>& GetItems() const
{ {
return m_items; return m_items;
} }

View File

@ -695,9 +695,9 @@ static int getMinDist( BOARD_CONNECTED_ITEM* aItem, const VECTOR2I& aPoint )
} }
bool CONNECTIVITY_DATA::TestTrackEndpointDangling( PCB_TRACK* aTrack, VECTOR2I* aPos ) bool CONNECTIVITY_DATA::TestTrackEndpointDangling( PCB_TRACK* aTrack, VECTOR2I* aPos ) const
{ {
std::list<CN_ITEM*> items = GetConnectivityAlgo()->ItemEntry( aTrack ).GetItems(); const std::list<CN_ITEM*>& items = GetConnectivityAlgo()->ItemEntry( aTrack ).GetItems();
// Not in the connectivity system. This is a bug! // Not in the connectivity system. This is a bug!
if( items.empty() ) if( items.empty() )

View File

@ -229,7 +229,7 @@ public:
void RunOnUnconnectedEdges( std::function<bool( CN_EDGE& )> aFunc ); void RunOnUnconnectedEdges( std::function<bool( CN_EDGE& )> aFunc );
bool TestTrackEndpointDangling( PCB_TRACK* aTrack, VECTOR2I* aPos = nullptr ); bool TestTrackEndpointDangling( PCB_TRACK* aTrack, VECTOR2I* aPos = nullptr ) const;
/** /**
* Function ClearLocalRatsnest() * Function ClearLocalRatsnest()