Languages

Facebook Twitter

PythonMonk - Interactive Python tutorials. 10 Things C++ Developers Learning C# Should Know. After taking a lot of time with C# fundamentals, I decided to go down a different road this week and talk about some of the differences in C# that can be troublesome to people who are used to C++ development but are learning C#.

10 Things C++ Developers Learning C# Should Know

My first post on this blog months ago was just a simple piece on how I divorced C++ as my first-love language (here). This is not to say that C++ is not still a valuable language, in fact as far as object-oriented languages go C++ is still king of performance. That said, C++ has a lot of quirks and idiosyncrasies due to its age and backward-compatibility with C that have caused it to take a back seat to C# and Java for business programming where time-to-market and maintainability are more important than having the absolute best performance.

C# especially has made huge inroads into the business development market because it offers a lot of the power of C++ without a lot of the danger. 1. This one should be obvious, so I put it right up front. 2. 3. 4. 3: public:

Web design and rules

Android. Frameworks and tools. Esoteric languages. Welcome to Scriptar.com. Teejeejee: Playing with C++0x. C++0x has a workload of new features[2]...

teejeejee: Playing with C++0x

Today I'm having a look at lambdas. Lambdas are available in g++-4.5, for now only available in experimental. What are lambdas? Closures are a very powerful tool that are being retrofitted in many languages (for instance Java). They can be used as building blocks for many useful programing idioms such as continuations. Enough for theory, let's have a look at this new beast. How do they look like? [](int i) { return i + 1; }; This is the increment lambda.

How to read this? Using a lambda To use it add arguments, for instance: [](int i) { return i + 1; }(0); would compute the value 1. Storing a lambda The type of a lambda is automatically deduced. Auto inc = [](int i) { return i + 1; }; std::cout << inc(0) << std::endl; Notice that calling a named lambda is not different from calling a function. Auto mult = [](int x, double y) -> double { return x * y; }; Capturing environment You can use lambdas to capture outter environment. Yes, mutable. Complete example. iOS Dev Center. Getting Started with MTJ. STL Containers. Library Standard Containers A container is a holder object that stores a collection of other objects (its elements).

STL Containers

They are implemented as class templates, which allows a great flexibility in the types supported as elements. The container manages the storage space for its elements and provides member functions to access them, either directly or through iterators (reference objects with similar properties to pointers). Containers replicate structures very commonly used in programming: dynamic arrays (vector), queues (queue), stacks (stack), heaps (priority_queue), linked lists (list), trees (set), associative arrays (map)...

Many containers have several member functions in common, and share functionalities. Stack, queue and priority_queue are implemented as container adaptors. Container class templates Sequence containers: array Array class (class template ) vector Vector (class template ) deque Double ended queue (class template ) forward_list Forward list (class template ) list Container adaptors: Learn C++