Skip to content

use references #2

Description

@jacobmerson

Your current code is making full copies of those vectors you should instead just get a const-reference to the array.

STOMMS/src/modeling.cc

Lines 24 to 30 in 8878501

std::vector <double> R = vm.R;
std::vector <double> Z = vm.Z;
std::vector <double> L = vm.L;
std::vector <double> iota = vm.iota;
std::vector <double> psi = vm.psi;
std::vector <double> xm = vm.xm;
std::vector <double> xn = vm.xn;

For example, you can do:

const std::vector <double>& xn = vm.xn; or better const auto& xn = vm.xn;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions