What does
private:
BOOL (LASreader::*read_simple)();
mean?
It's from LAStools, in lasreader.hpp
BOOL
is a typedef bool
(from mydefs.hpp), but I don't know what this line is declaring, specifically the ::*
(double colon asterisk), and that it looks like a function call.
It means to perform a bitwise operation with the values on the left and right-hand side, and then assign the result to the variable on the left, so a bit of a short form.
Variable is basically nothing but the name of a memory location that we use for storing data. We can change the value of a variable in C or any other language, and we can also reuse it multiple times.
In C++, scope resolution operator is ::. It is used for following purposes. 1) To access a global variable when there is a local variable with same name: // C++ program to show that we can access a global variable. // using scope resolution operator :: when there is a local.
It's a pointer to member function. Specifically, read_simple
is a pointer to a member function of class LASreader
that takes zero arguments and returns a BOOL
.
From the example in the cppreference:
struct C {
void f(int n) { std::cout << n << '\n'; }
};
int main()
{
void (C::*p)(int) = &C::f; // p points at member f of class C
C c;
(c.*p)(1); // prints 1
C* cptr = &c;
(cptr->*p)(2); // prints 2
}
BOOL (LASreader::*read_simple)();
read_simple
is a pointer to a member function of class LASreader
that takes no arguments and returns a BOOL
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With