diff --git a/include/rexy/compat/cpp17/traits.hpp b/include/rexy/compat/cpp17/traits.hpp new file mode 100644 index 0000000..1ad68f9 --- /dev/null +++ b/include/rexy/compat/cpp17/traits.hpp @@ -0,0 +1,73 @@ +/** + This file is a part of rexy's general purpose library + Copyright (C) 2022 rexy712 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef REXY_COMPAT_CPP17_TRAITS_HPP +#define REXY_COMPAT_CPP17_TRAITS_HPP + +namespace rexy{ + + template + struct remove_volatile{ + using type = T; + }; + template + struct remove_volatile{ + using type = T; + }; + template + using remove_volatile_t = typename remove_volatile::type; + template + struct remove_const{ + using type = T; + }; + template + struct remove_const{ + using type = T; + }; + template + using remove_const_t = typename remove_const::type; + template + struct remove_cv{ + using type = remove_volatile_t>; + }; + template + using remove_cv_t = typename remove_cv::type; + template + struct remove_reference{ + using type = T; + }; + template + struct remove_reference{ + using type = T; + }; + template + struct remove_reference{ + using type = T; + }; + template + using remove_reference_t = typename remove_reference::type; + template + struct remove_cvref{ + using type = remove_cv_t>; + }; + template + using remove_cvref_t = typename remove_cvref::type; + +} + +#endif diff --git a/include/rexy/compat/cpp20/traits.hpp b/include/rexy/compat/cpp20/traits.hpp new file mode 100644 index 0000000..8c8fd8e --- /dev/null +++ b/include/rexy/compat/cpp20/traits.hpp @@ -0,0 +1,33 @@ +/** + This file is a part of rexy's general purpose library + Copyright (C) 2022 rexy712 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef REXY_COMPAT_CPP17_TRAITS_HPP +#define REXY_COMPAT_CPP17_TRAITS_HPP + +#include //remove_cvref + +namespace rexy{ + + template + struct remove_cvref : public std::remove_cvref{}; + template + using remove_cvref_t = typename remove_cvref::type; + +} + +#endif diff --git a/include/rexy/compat/traits.hpp b/include/rexy/compat/traits.hpp new file mode 100644 index 0000000..0a93ebc --- /dev/null +++ b/include/rexy/compat/traits.hpp @@ -0,0 +1,29 @@ +/** + This file is a part of rexy's general purpose library + Copyright (C) 2022 rexy712 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef REXY_COMPAT_TRAITS_HPP +#define REXY_COMPAT_TRAITS_HPP + +#ifdef REXY_STANDARD_CPP20 + #include "cpp20/traits.hpp" +#else // REXY_STANDARD_CPP26 + #include "cpp17/traits.hpp" +#endif // REXY_STANDARD_CPP26 + + +#endif diff --git a/include/rexy/traits.hpp b/include/rexy/traits.hpp index 6822344..7437347 100644 --- a/include/rexy/traits.hpp +++ b/include/rexy/traits.hpp @@ -1,6 +1,6 @@ /** This file is a part of rexy's general purpose library - Copyright (C) 2020 rexy712 + Copyright (C) 2020-2022 rexy712 This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,6 +22,7 @@ #include //is_same, decay, integral_constant, declval #include //iterator_traits +#include "compat/traits.hpp" #include "rexy.hpp" namespace rexy{ @@ -54,59 +55,6 @@ namespace rexy{ static constexpr bool value = std::is_same*>(nullptr)))>::value; }; -#ifdef REXY_STANDARD_CPP20 - template - struct remove_cvref : public std::remove_cvref{}; - template - using remove_cvref_t = typename remove_cvref::type; -#else // REXY_STANDARD_CPP26 - template - struct remove_volatile{ - using type = T; - }; - template - struct remove_volatile{ - using type = T; - }; - template - using remove_volatile_t = typename remove_volatile::type; - template - struct remove_const{ - using type = T; - }; - template - struct remove_const{ - using type = T; - }; - template - using remove_const_t = typename remove_const::type; - template - struct remove_cv{ - using type = remove_volatile_t>; - }; - template - using remove_cv_t = typename remove_cv::type; - template - struct remove_reference{ - using type = T; - }; - template - struct remove_reference{ - using type = T; - }; - template - struct remove_reference{ - using type = T; - }; - template - using remove_reference_t = typename remove_reference::type; - template - struct remove_cvref{ - using type = remove_cv_t>; - }; - template - using remove_cvref_t = typename remove_cvref::type; -#endif // REXY_STANDARD_CPP26 template struct is_dereferencable : public std::false_type{};