/*
* This file is part of the DXX-Rebirth project .
* It is copyright by its individual contributors, as recorded in the
* project's Git history. See COPYING.txt at the top level for license
* terms and a link to the Git history.
*/
#pragma once
#include
#include
#include "dxxsconf.h"
#include "compiler-array.h"
template
class cstring_tie
{
void init_array(const char *s) __attribute_nonnull()
{
p[m_count++] = s;
}
template
void init_array(const char *s, Args&&... args)
{
init_array(s);
init_array(std::forward(args)...);
}
public:
template
cstring_tie(Args&&... args) : m_count(0)
{
static_assert(sizeof...(Args) <= maximum_arity, "too many arguments to cstring_tie");
init_array(std::forward(args)...);
}
unsigned count() const { return m_count; }
const char *string(std::size_t i) const { return p[i]; }
enum { maximum_arity = N };
private:
array p;
unsigned m_count;
};