C++

KP Astrology REST Server: Part 2

Written by on June 8, 2024 in Astrology, C++ with 0 Comments
KP Astrology REST Server: Part 2

In my earlier article, I had briefly described the REST server I wanted to build for Krishnamurti Padhdhati system of astrology. After a long time I have managed to complete the implementation and it is now ready for deployment. In this article, I will go over some of its features with the hope it will […]

Continue Reading

Book Review: C++ Initialization Story

Written by on November 6, 2023 in Book Review, C++ with 0 Comments
Book Review: C++ Initialization Story

Title: C++ Initialization Story – A Guide Through All Initialization Options and Related C++ Areas Author: Bartłomiej Filipek Publisher: Leanpub Year: 2023 Can you believe that there is a language where “initialization” itself involves many subtleties and a whole book can be devoted to this topic? Yes, modern C++ is such a language! While many […]

Continue Reading

C++20: “constinit” Specifier

Written by on October 15, 2023 in C++, Programming with 0 Comments
C++20: “constinit” Specifier

The constinit specifier, introduced in C++20, is applied to static variables (global and local static) and thread local variables, with the requirement that they either have a zero initialization or they are initialized with a compile-time constant expression. Here is our first example: Line 17 declares a global constinit variable, initialized with a constant value. […]

Continue Reading

C++23: if consteval

Written by on September 24, 2023 in C++, Programming with 0 Comments
C++23: if consteval

“If consteval” is useful in the context of calling a consteval function from within a constexpr function. A consteval function can only be invoked in a constant expression and hence is evaluated at compile-time. On the other hand, a constexpr function may be invoked in a constant expression or non-constant expression. If invoked in a […]

Continue Reading

std::is_scoped_enum<>

Written by on August 13, 2023 in C++, Programming with 0 Comments
std::is_scoped_enum<>

The type trait “std::is_scoped_enum<T>::value” was introduced in C++23 to check whether the type “T” is a scoped enum type. Another way to use this is std::is_scoped_enum_v<T>. Before getting into this trait in detail, let us briefly recap the differences between unscoped and scoped enums. Unscoped Enums Unscoped enums are the old-style enums. Look at the […]

Continue Reading

C++23: “stacktrace” Library

Written by on June 6, 2023 in C++, Programming with 0 Comments
C++23: “stacktrace” Library

The ability to enumerate stack frames at runtime is one of the interesting features introduced in C++23. This is made possible through the <stacktrace> header. The interface is quite simple. Here is a piece of code showing how to use the library. There are 4 functions and here is the call chain: The “dumpStackTrace()” function […]

Continue Reading

std::expected<>

Written by on May 13, 2023 in C++, Programming with 0 Comments
std::expected<>

I had written about std::optional<> in an earlier article. C++23 introduces std::expected<> as an interesting extension to std::optional<>. Whereas std::optional<> contains a value or none at all, std::expected<> contains a value or an error code associated with it. This gives better control to the caller in terms of handling the outcome of the function call. […]

Continue Reading

Std::tie

Written by on December 25, 2022 in C++, Programming with 0 Comments
Std::tie

std::tuple is a widely used abstraction in C++ and has been around since C++11. It is a generalization of std::pair. std::tie is convenient when we want to create a tuple of lvalue references to existing variables. It is a function template commonly used to unpack a tuple into individual objects. In the above example, we […]

Continue Reading

Why Learn C++

Written by on November 7, 2022 in C++, Programming with 0 Comments

This is the third and the last article in the series “Why Learn Language-XYZ?”. I talked about Prolog and Lisp earlier. The present article is on C++. Once you have gained reasonable proficiency with Prolog and Lisp, you are ready to learn C++! In my view, C++ is a complex language and requires sufficient maturity […]

Continue Reading

Book Review: Embracing Modern C++ Safely

Written by on September 18, 2022 in Book Review, C++ with 0 Comments
Book Review: Embracing Modern C++ Safely

Title: Embracing Modern C++ Safely Authors: John Laos, Vittorio Romeo, Rostislav Khlebnikov, and Alisdair Meredith Publisher: Pearson Education, Inc. Year: 2022 C++ is a complex language. Fortunately, we have several good books (and other online material) for programmers at various levels. A few weeks ago, I had reviewed and recommended “Beautiful C++”, book suitable for […]

Continue Reading

Top