From 9d5e46cd53d028ecaba5786d770e813610d1a05b Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Tue, 28 May 2019 14:33:57 +0200 Subject: [PATCH] Custom type_traits header added --- src/include/units/bits/type_traits.h | 48 ++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/include/units/bits/type_traits.h diff --git a/src/include/units/bits/type_traits.h b/src/include/units/bits/type_traits.h new file mode 100644 index 00000000..4a9c8a50 --- /dev/null +++ b/src/include/units/bits/type_traits.h @@ -0,0 +1,48 @@ +// The MIT License (MIT) +// +// Copyright (c) 2018 Mateusz Pusz +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. + +#pragma once + +#include + +namespace units { + + namespace detail { + + template + struct conditional_impl { + template + using type = F; + }; + + template<> + struct conditional_impl { + template + using type = T; + }; + + } + + template + using conditional = detail::conditional_impl::template type; + +}