Tags » C#

Keep control of your entities

Today I want to share tips to improve the control you have over your code and especially over your entities in a Oriented Object language… 540 more words

.NET

Using a local copy of Boost on your cluster account

Boost is a set of libraries for C++.  It increases the language’s functionality, allowing you to do all sorts of interesting things (for example it has lots of random number generators).   316 more words

C++

#1,173 - Lambda Expression Can Be Just an Expression

You’ll often see lambda expressions written as either a single statement (no return value) or a block of statements (optional return value).

        static void SomeMethod(int i, string s)
        {
            // do something with int and string
        }

        static void Main(string[] args)
        {
            // Single statement
            Action<int, string> thing1 = (i, s) => SomeMethod(i, s);

            // Block of statements, no return value
            Action<int, string> thing2 = (i, s) =>
            {
                for (int i2 = i; i2 <= i + 10; i2++)
                    SomeMethod(i2, s);
            };

            // Block of statements with return value
            Func<int,int> thing3 = (i) =>
            {
                SomeMethod(i, "x");
                return i + 1;
            };
        }
… 41 more words
C#

Nesting lambdas


int main(void)
{
    auto add2 = [](int x) {
        return [=](int y) {
            return x + y;
        };
    };

    std::cout << add2(3)(6);
}

C++

COMPOSITION AND INHERITANCE

  • In real-life, complex objects are often built from smaller, simpler objects. For example, a car is built using a metal frame, an engine, some tires, a transmission, a steering wheel, and a large number of other parts.
  • 444 more words
C++