summaryrefslogtreecommitdiff
path: root/docs/data/core/string_literal.json
blob: 4bd6e9be52b7c30dc81640953c563804085b4fed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
{
	"format": 1,
	"id": "saw-string_literal",
	"kind": "class",
	"name": "string_literal",
	"namespace": "saw",
	"module": "core",
	"header": "modules/core/c++/string_literal.hpp",
	"brief_description": "Helper object which turns a string literal into a template parameter.",
	"detailed_description": [
		[
			"It guarantees compile time uniqueness and thus allows using strings in template parameters. Everything in this codebase which is addressed by name rests on it: struct members, interface functions, and the schema hashes derived from them."
		],
		[
			"Because the length is part of the type, two literals of different length are different types, and comparing them is a compile time false rather than an error."
		]
	],
	"templates": [
		{"name": "CharT", "kind": "type"},
		{"name": "N", "kind": "non_type", "type": "size_t", "brief_description": "Length including the null terminator."}
	],
	"attributes": {
		"saw-string_literal-data": {
			"id": "saw-string_literal-data",
			"name": "data",
			"type": ["std::array< CharT, N >"],
			"visibility": "public"
		}
	},
	"functions": {
		"saw-string_literal-ctor": {
			"id": "saw-string_literal-ctor",
			"name": "string_literal",
			"type": [],
			"brief_description": "From a literal. Copies it character by character so the whole thing is constexpr.",
			"parameters": [
				{"name": "input", "type": ["const CharT (&)[N]"]}
			]
		},
		"saw-string_literal-view": {
			"id": "saw-string_literal-view",
			"name": "view",
			"type": ["std::string_view"],
			"const": true,
			"brief_description": "The literal as a view, for the places which compare against runtime strings."
		},
		"saw-string_literal-eq": {
			"id": "saw-string_literal-eq",
			"name": "operator==",
			"type": ["bool"],
			"const": true,
			"brief_description": "Equality. A literal of different length is never equal.",
			"parameters": [
				{"name": "rhs", "type": ["const string_literal< CharTR, NR > &"]}
			]
		},
		"saw-string_literal-plus": {
			"id": "saw-string_literal-plus",
			"name": "operator+",
			"type": ["string_literal< CharT, N+NR-1 >"],
			"const": true,
			"brief_description": "Concatenation, dropping the null terminator of the left side.",
			"templates": [
				{"name": "NR", "kind": "non_type", "type": "size_t"}
			],
			"parameters": [
				{"name": "rhs", "type": ["const string_literal< CharT, NR > &"]}
			]
		}
	},
	"notes": [
		"The literal operator \"\"_sl builds one from a quoted string."
	]
}