Skip to content

Commit ac4295e

Browse files
committed
Minor optimization.
1 parent f9a7302 commit ac4295e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/feature/feature-posture.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ namespace dynamicgraph {
9292

9393
dg::Vector& FeaturePosture::computeError( dg::Vector& res, int t)
9494
{
95-
dg::Vector state = state_.access (t);
96-
dg::Vector posture = posture_.access (t);
95+
const dg::Vector& state = state_.access (t);
96+
const dg::Vector& posture = posture_.access (t);
9797

9898
res.resize (nbActiveDofs_);
9999
std::size_t index=0;
@@ -135,11 +135,11 @@ namespace dynamicgraph {
135135
void
136136
FeaturePosture::selectDof (unsigned dofId, bool control)
137137
{
138-
dg::Vector state = state_.accessCopy();
139-
dg::Vector posture = posture_.accessCopy ();
140-
unsigned int dim = state.size();
138+
const Vector& state = state_.accessCopy();
139+
const Vector& posture = posture_.accessCopy ();
140+
std::size_t dim (state.size());
141141

142-
if (dim != posture.size ()) {
142+
if (dim != (std::size_t)posture.size ()) {
143143
throw std::runtime_error
144144
("Posture and State should have same dimension.");
145145
}

0 commit comments

Comments
 (0)