0
StaticEquilibriumConstraint::StaticEquilibriumConstraint(
    const MultibodyPlant<AutoDiffXd>* plant,
    systems::Context<AutoDiffXd>* context,
    const std::map<SortedPair<geometry::GeometryId>,
                   GeometryPairContactWrenchEvaluatorBinding>&
        contact_pair_to_wrench_evaluator)
    : solvers::Constraint(plant->num_velocities(),
                          plant->num_positions() + plant->num_actuated_dofs() +
                              GetLambdaSize(contact_pair_to_wrench_evaluator),
                          Eigen::VectorXd::Zero(plant->num_velocities()),
                          Eigen::VectorXd::Zero(plant->num_velocities())),
      plant_{plant},
      context_{context},
      contact_pair_to_wrench_evaluator_(contact_pair_to_wrench_evaluator),
      B_actuation_{plant_->MakeActuationMatrix()} {}

What is the bit of code that starts with ":solvers::Constraint"? What is that called in C++

It is NOT an initializer list, because no variables are declared after the colon. So please, do not link me to that question.

user3180
  • 1,369
  • 1
  • 21
  • 38
  • 1
    The linked question does NOT answer my question. – user3180 Nov 11 '21 at 02:04
  • There is no assignment happening in the code snippet I posted – user3180 Nov 11 '21 at 02:05
  • 1
    Why do you think this isn't the constructor initializer list? (It is) – Chad Nov 11 '21 at 02:10
  • 1
    @user3180 It is a [member initializer list](https://en.cppreference.com/w/cpp/language/constructor). It just so happens to contain a delegated constructor call, which may be the part that's confusing things. – Brian61354270 Nov 11 '21 at 02:12
  • In the previous question, the syntax was var(assignment_variable), and it essentially did var = assignment_variable. – user3180 Nov 11 '21 at 04:28
  • I guess Constraint(*inputs) doesn't look like that. There is no target variable we are assigning to (like "var"). – user3180 Nov 11 '21 at 04:28
  • I also don't understand what is the point of creating all these variables like plant_ if the body is empty {}. What do we even do with these initialized variables? – user3180 Nov 11 '21 at 04:29
  • 3
    This ***is*** an initializer list. You are initializing the base class by calling its constructor. See [[class.base.init](https://timsong-cpp.github.io/cppwp/n3337/class.base.init)] in the language standard. – Cody Gray - on strike Nov 11 '21 at 13:57

0 Answers0