C++14 Features

In this post we discuss some of the key features added in C++14. In particular, we look at the following enhancements: Language features: Automatic return type deduction Generic lambdas Extended constexpr functionality Standard library features: std::make_unique Additional user-defined literals Language features Automatic return type deduction It is now possible for the compiler to deduce the … Read more

Trailing Return Type

The trailing return type feature was added in C++11. This feature allows you to specify the return type after a function declaration instead of before. In order to see how this is can be useful, we shall look at a simple example. Suppose we have an Employee class which records an employee’s salary and whether … Read more

Configuring Emacs

Emacs is a powerful, extensible text editor which is available for just about any operating system. It can be run in console mode which makes it useful for editing scripts and config files through a terminal emulator. However, configuring Emacs to behave in the way you want can be a daunting and time-consuming task. Here, … Read more

Am I Using C# 8.0?

Last week I was working on a C# project in VS2019 and I wanted to use some language features from C# 8.0 (in particular ‘using declarations’). So how do we check if a project is using C# 8.0? The logical place to look is the project settings. Right-click on the project and select Properties=>Build. Scroll … Read more

LINQ

LINQ (Language-integrated query) provides a common query syntax for dealing with objects, databases and XML. It was introduced in C# 3.0. In this post we shall look at using LINQ to Objects. LINQ to Objects can be used with enumerable objects such as arrays, lists and strings. There are two ways to access LINQ in … Read more

Categories C#

Generics

Generics in C# allow you to generalise classes and methods to work with different underlying types. Generics are used in many of the C# collections such as List, Vector and Queue. Using generics allows the compiler to enforce type-safety. List, Vector etc. are examples of generic classes. It is also possible to define generic methods. … Read more

Categories C#