I have 8 years of coding experience, but I have never seen the operator []
passed as a parameter to the function definition.
For example, the following code (from an open source project):
bree::porder(m_root, [] (treenode* node) { delete node; });
Throughout my coding life, I have always defined []
as an operator overloader, not as a parameter.
So what does this new syntax signify?
I am using the compiler that comes with Visual Studio 2003. How can I change the above code so that it will compile in VS 2003?
The syntax of the C programming language is the set of rules governing writing of software in the C language. It is designed to allow for programs that are extremely terse, have a close relationship with the resulting object code, and yet provide relatively high-level data abstraction.
One of the reasons C++ is rather complicated is because it was designed to address problems that crop up in large programs. At the time C++ was created as AT&T, their biggest C program was about 10 million lines of code. At that scale, C doesn't function very well.
That is a c++ lambda you could replace the code with a function object of the same definition. The link shows two examples one using Functor and one using a lambda.
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