#help

23 messages · Page 1 of 1 (latest)

hearty thistle
#

What does : mean here in constructor? Is it some kind of way to inherit something in constructor declaration?

GeneralizedEigenSolver()
      : m_eivec(),
        m_alphas(),
        m_betas(),
        m_computeEigenvectors(false),
        m_isInitialized(false),
        m_realQZ()
    {}

Original source code: https://gitlab.com/libeigen/eigen/-/blob/master/Eigen/src/Eigenvalues/GeneralizedEigenSolver.h

dense solarBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For more information use !howto ask.

patent cave
#

Its special way of initializing member variables. I dont know what exactly its called and what are the benefits but e.g. you can initialize a pointer:

In hpp:

public:
   Class(int* tmp);

private:
   int* m_pointer;

In cpp:

Class::Class(int* tmp) : m_pointer(tmp)
{
}

Now the member variable m_pointer points to the same like tmp does.

#

Seems like its called an "initialization list"

heavy spire
patent cave
#

Better and more detailed than my explanation👍🏼

heavy spire
patent cave
#

Yours is more professional :P

acoustic adder
hearty thistle
#

well. then m_name is a convention to call private variables, in this case?

heavy spire
#

inside the body of a constructor, function, whatever, to access a field you have 3 options

#

the field name literally - works well unless there are local variables or function parameters reusing the name

#

this->myFieldName works well, handles duplicate names with local variables and function parameters, but not with duplicate field names coming from inherited classes

#
MyClassName::myFieldName

the only approach guaranteed to NOT be amibguous in all the situations

#

@hearty thistle

#

this is a pointer to the current object you are working with, the pointer cannot be redirected

#

also, this is a keyword in C++

dense solarBOT
#

You can only solve threads you own

hearty thistle
#

!resolve

#

!solve

#

!solved