mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 10:13:19 +02:00
Avoid copies when using auto
This commit is contained in:
parent
906c2f3d49
commit
c0622eaa45
@ -639,8 +639,9 @@ std::map<int, COLOR4D> BOARD_ADAPTER::GetLayerColors() const
|
||||
const BOARD_STACKUP& stackup = m_board->GetDesignSettings().GetStackupDescriptor();
|
||||
KIGFX::COLOR4D bodyColor( 0, 0, 0, 0 );
|
||||
|
||||
// Can't do a const KIGFX::COLOR4D& return type here because there are temporary variables
|
||||
auto findColor =
|
||||
[]( const wxString& aColorName, const CUSTOM_COLORS_LIST& aColorSet )
|
||||
[]( const wxString& aColorName, const CUSTOM_COLORS_LIST& aColorSet ) -> const KIGFX::COLOR4D
|
||||
{
|
||||
if( aColorName.StartsWith( wxT( "#" ) ) )
|
||||
{
|
||||
|
@ -215,7 +215,7 @@ void LISTBOX_TRICKS::OnListBoxRDown( wxMouseEvent& aEvent )
|
||||
{
|
||||
wxMenu menu;
|
||||
|
||||
const auto mstr = [&]( const MENU_ID& id )
|
||||
const auto mstr = [&]( const MENU_ID& id ) -> const wxString&
|
||||
{
|
||||
return m_menuStrings[id];
|
||||
};
|
||||
|
@ -65,7 +65,7 @@ public:
|
||||
return m_categoryDescriptions.at( aCategoryName );
|
||||
}
|
||||
|
||||
auto getCachedParts() { return m_cache; }
|
||||
auto& getCachedParts() { return m_cache; }
|
||||
|
||||
private:
|
||||
// This is clunky but at the moment the only way to free the pointer after use without KiCad crashing.
|
||||
|
@ -131,8 +131,9 @@ EXPORTER_PCB_VRML::EXPORTER_PCB_VRML( BOARD* aBoard ) :
|
||||
|
||||
const BOARD_STACKUP& stackup = m_board->GetDesignSettings().GetStackupDescriptor();
|
||||
|
||||
// Can't do a const KIGFX::COLOR4D& return type here because there are temporary variables
|
||||
auto findColor =
|
||||
[]( const wxString& aColorName, const CUSTOM_COLORS_LIST& aColorSet )
|
||||
[]( const wxString& aColorName, const CUSTOM_COLORS_LIST& aColorSet ) -> const KIGFX::COLOR4D
|
||||
{
|
||||
if( aColorName.StartsWith( wxT( "#" ) ) )
|
||||
{
|
||||
|
@ -2282,8 +2282,8 @@ int DRAWING_TOOL::PlaceTuningPattern( const TOOL_EVENT& aEvent )
|
||||
|
||||
auto applyCommonSettings = [&]( PCB_TUNING_PATTERN* aPattern )
|
||||
{
|
||||
auto origTargetLength = aPattern->GetSettings().m_targetLength;
|
||||
auto origTargetSkew = aPattern->GetSettings().m_targetSkew;
|
||||
const auto& origTargetLength = aPattern->GetSettings().m_targetLength;
|
||||
const auto& origTargetSkew = aPattern->GetSettings().m_targetSkew;
|
||||
|
||||
aPattern->GetSettings() = meanderSettings;
|
||||
|
||||
|
@ -557,7 +557,7 @@ bool MULTI_DRAGGER::multidragMarkObstacles( std::vector<MDRAG_LINE>& aCompletedL
|
||||
{
|
||||
for( int l2 = l1 + 1; l2 < aCompletedLines.size(); l2++ )
|
||||
{
|
||||
auto l1l = aCompletedLines[l1].draggedLine;
|
||||
const auto& l1l = aCompletedLines[l1].draggedLine;
|
||||
auto l2l = aCompletedLines[l2].draggedLine;
|
||||
|
||||
if( clipToOtherLine( m_lastNode, l1l, l2l ) )
|
||||
|
Loading…
x
Reference in New Issue
Block a user