Search⌘ K

Raw and Cooked

Explore raw and cooked literal operators in C++. Understand how literals are defined, the differences in handling raw strings versus cooked values, and how the compiler chooses between them. This lesson helps you grasp the concept of user-defined literals and the types they support, enhancing your ability to work with C++ literals effectively.

We'll cover the following...

The literal operator is available in two types:

  1. Raw
  2. Cooked

Raw #

The raw form accepts its arguments as (const char*, size_t), (const char*) or const char:

1.45_km => operator "" _km("1.45")

The raw string literals we talked about earlier fall under this category.

Cooked

...