libcruft-util/coord/init.hpp
Danny Robson f6056153e3 rename root namespace from util to cruft
This places, at long last, the core library code into the same namespace
as the extended library code.
2018-08-05 14:42:02 +10:00

81 lines
2.3 KiB
C++

/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Copyright 2015 Danny Robson <danny@nerdcruft.net>
*/
#ifndef CRUFT_UTIL_COORD_INIT_HPP
#define CRUFT_UTIL_COORD_INIT_HPP
#include "store.hpp"
#include <cstddef>
namespace cruft::coord {
template <size_t S, typename T, typename SelfT>
struct init;
//-------------------------------------------------------------------------
template <typename T, typename SelfT>
struct init<1,T,SelfT> : public store<1,T,SelfT>
{
using store<1,T,SelfT>::store;
constexpr init () = default;
constexpr init (T v0):
store<1,T,SelfT> ({v0})
{ ; }
};
//-------------------------------------------------------------------------
template <typename T, typename SelfT>
struct init<2,T,SelfT> : public store<2,T,SelfT>
{
using store<2,T,SelfT>::store;
constexpr init () = default;
constexpr init (T v0, T v1):
store<2,T,SelfT> ({ v0, v1 })
{ ; }
};
//-------------------------------------------------------------------------
template <typename T, typename SelfT>
struct init<3,T,SelfT> : public store<3,T,SelfT>
{
using store<3,T,SelfT>::store;
constexpr init () = default;
constexpr init (T v0, T v1, T v2):
store<3,T,SelfT> ({v0, v1, v2})
{ ; }
};
//-------------------------------------------------------------------------
template <typename T, typename SelfT>
struct init<4,T,SelfT> : public store<4,T,SelfT>
{
using store<4,T,SelfT>::store;
constexpr init () = default;
constexpr init (T v0, T v1, T v2, T v3):
store<4,T,SelfT> ({ v0, v1, v2, v3 })
{ ; }
};
//-------------------------------------------------------------------------
template <typename T, typename SelfT>
struct init<5,T,SelfT> : public store<5,T,SelfT>
{
using store<5,T,SelfT>::store;
constexpr init () = default;
constexpr init (T v0, T v1, T v2, T v3, T v4):
store<5,T,SelfT> ({ v0, v1, v2, v3, v4 })
{ ; }
};
}
#endif