# Literals¶

This file contains the documentation for literal operator"" _w.

namespace libsemigroups::literals

Functions

word_type operator""_w(const char *w, size_t n)

Literal for defining word_type over integers less than 10.

This operator provides a convenient brief means of constructing a word_type from an sequence of literal integer digits or a string. For example, 0123_w produces the same output as word_type({0, 1, 2, 3}).

There are some gotchas and this operator should be used with some care:

• the parameter w must only consist of the integers $$\{0, \ldots, 9\}$$. For example, there are no guarantees about the value of "abc"_w.

• if w starts with 0 and is follows by a value greater than 7, then it is necessary to enclose w in quotes. For example, 08_w will not compile because it is interpreted as an invalid octal. However "08"_w behaves as expected.

Warning

This operator performs no checks on its arguments whatsoever.

Parameters
• w – the letters of the word

• n – the length of w (defaults to the length of w)

Throws

(None) – This function guarantees not to throw a LibsemigroupsException.

Returns

A value of type word_type.

word_type operator""_w(const char *w)