/* * 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 2018 Danny Robson */ #pragma once #include "../std.hpp" #include #include namespace cruft::types { //------------------------------------------------------------------------- enum class category { NONE, UNSIGNED, SIGNED, REAL, }; //------------------------------------------------------------------------- struct description { enum category category; std::size_t width; }; //------------------------------------------------------------------------- template struct category_traits; template <> struct category_traits : public std::integral_constant {}; template <> struct category_traits : public std::integral_constant {}; template <> struct category_traits : public std::integral_constant {}; template <> struct category_traits : public std::integral_constant {}; template <> struct category_traits : public std::integral_constant {}; template <> struct category_traits : public std::integral_constant {}; template <> struct category_traits : public std::integral_constant {}; template <> struct category_traits : public std::integral_constant {}; template <> struct category_traits : public std::integral_constant {}; template <> struct category_traits : public std::integral_constant {}; template constexpr auto category_traits_v = category_traits::value; //------------------------------------------------------------------------- template constexpr description make_description (void) noexcept { return { .category = category_traits_v, .width = sizeof (T) }; } } #include namespace cruft::types { std::ostream& operator<< (std::ostream&, category); std::ostream& operator<< (std::ostream&, description); }