Nix
2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Toggle main menu visibility
Loading...
Searching...
No Matches
array-from-string-literal.hh
Go to the documentation of this file.
1
#pragma once
3
4
#include <algorithm>
5
#include <array>
6
7
namespace
nix {
8
9
template
<
size_t
sizeWithNull>
10
struct
ArrayNoNullAdaptor
11
{
12
std::array<char, sizeWithNull - 1> data;
13
14
constexpr
ArrayNoNullAdaptor(
const
char
(&init)[sizeWithNull])
15
{
16
static_assert
(sizeWithNull > 0);
17
std::copy_n(init, sizeWithNull - 1, data.data());
18
}
19
};
20
21
template
<ArrayNoNullAdaptor str>
22
constexpr
auto
operator
""
_arrayNoNull()
23
{
24
return
str.data;
25
}
26
27
}
// namespace nix
libutil
include
nix
util
array-from-string-literal.hh
Generated by
1.18.0