Browse Source

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
7.0
Seth Hillbrand 3 years ago
parent
commit
66e9d5c61c
  1. 2
      pcbnew/connectivity/connectivity_algo.h
  2. 4
      pcbnew/connectivity/connectivity_data.cpp
  3. 2
      pcbnew/connectivity/connectivity_data.h

2
pcbnew/connectivity/connectivity_algo.h

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

4
pcbnew/connectivity/connectivity_data.cpp

@ -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!
if( items.empty() )

2
pcbnew/connectivity/connectivity_data.h

@ -229,7 +229,7 @@ public:
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()

Loading…
Cancel
Save