-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ R-values are now passable into lots of things!
— Closes #22
- Loading branch information
Showing
12 changed files
with
283 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// ============================================================================= | ||
// | ||
// ztd.text | ||
// Copyright © 2021 JeanHeyd "ThePhD" Meneide and Shepherd's Oasis, LLC | ||
// Contact: opensource@soasis.org | ||
// | ||
// Commercial License Usage | ||
// Licensees holding valid commercial ztd.text licenses may use this file in | ||
// accordance with the commercial license agreement provided with the | ||
// Software or, alternatively, in accordance with the terms contained in | ||
// a written agreement between you and Shepherd's Oasis, LLC. | ||
// For licensing terms and conditions see your agreement. For | ||
// further information contact opensource@soasis.org. | ||
// | ||
// Apache License Version 2 Usage | ||
// Alternatively, this file may be used under the terms of Apache License | ||
// Version 2.0 (the "License") for non-commercial use; you may not use this | ||
// file except in compliance with the License. You may obtain a copy of the | ||
// License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// ============================================================================> | ||
|
||
#pragma once | ||
|
||
#ifndef ZTD_RANGES_VIEW_HPP | ||
#define ZTD_RANGES_VIEW_HPP | ||
|
||
#include <ztd/ranges/version.hpp> | ||
|
||
#include <ztd/ranges/range.hpp> | ||
|
||
#if ZTD_IS_ON(ZTD_STD_LIBRARY_RANGES_I_) | ||
#include <ranges> | ||
#endif | ||
|
||
#include <ztd/prologue.hpp> | ||
|
||
namespace ztd { namespace ranges { | ||
ZTD_RANGES_INLINE_ABI_NAMESPACE_OPEN_I_ | ||
|
||
namespace __rng_detail { | ||
template <typename _Ty> | ||
inline constexpr bool __enable_view | ||
#if ZTD_IS_ON(ZTD_STD_LIBRARY_RANGES_I_) | ||
::std::ranges::enable_view<_Ty> | ||
#else | ||
= false | ||
#endif | ||
; | ||
} // namespace __rng_detail | ||
|
||
template <typename _Ty> | ||
struct is_view | ||
: ::std::integral_constant<bool, | ||
(__rng_detail::__enable_view<_Ty> && is_range_v<_Ty> // clang-format hack | ||
&& ::std::is_move_constructible_v<_Ty> && ::std::is_move_assignable_v<_Ty>) | ||
|| (is_range_v<_Ty> && !::std::is_const_v<_Ty> && ::std::is_lvalue_reference_v<_Ty>) // clang-format | ||
// hack | ||
> { }; | ||
|
||
template <typename _Ty> | ||
inline constexpr bool is_view_v = is_view<_Ty>::value; | ||
|
||
ZTD_RANGES_INLINE_ABI_NAMESPACE_CLOSE_I_ | ||
}} // namespace ztd::ranges | ||
|
||
#include <ztd/epilogue.hpp> | ||
|
||
#endif // ZTD_RANGES_VIEW_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
|
||
|
||
|
||
|
||
// ============================================================================= | ||
// | ||
// ztd.text | ||
// Copyright © 2021 JeanHeyd "ThePhD" Meneide and Shepherd's Oasis, LLC | ||
// Contact: opensource@soasis.org | ||
// | ||
// Commercial License Usage | ||
// Licensees holding valid commercial ztd.text licenses may use this file in | ||
// accordance with the commercial license agreement provided with the | ||
// Software or, alternatively, in accordance with the terms contained in | ||
// a written agreement between you and Shepherd's Oasis, LLC. | ||
// For licensing terms and conditions see your agreement. For | ||
// further information contact opensource@soasis.org. | ||
// | ||
// Apache License Version 2 Usage | ||
// Alternatively, this file may be used under the terms of Apache License | ||
// Version 2.0 (the "License") for non-commercial use; you may not use this | ||
// file except in compliance with the License. You may obtain a copy of the | ||
// License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// ============================================================================> | ||
|
||
#pragma once | ||
|
||
#ifndef ZT_TEXT_DETAIL_FORWARD_IF_MOVE_ONLY_HPP | ||
#define ZT_TEXT_DETAIL_FORWARD_IF_MOVE_ONLY_HPP | ||
|
||
#include <ztd/text/version.hpp> | ||
|
||
#include <type_traits> | ||
#include <utility> | ||
|
||
#include <ztd/prologue.hpp> | ||
|
||
namespace ztd { namespace text { | ||
ZTD_TEXT_INLINE_ABI_NAMESPACE_OPEN_I_ | ||
namespace __txt_detail { | ||
|
||
template <typename _Val> | ||
decltype(auto) __forward_if_move_only(_Val&& __val) noexcept { | ||
constexpr bool _IsMoveOnly | ||
= ::std::is_rvalue_reference_v< | ||
_Val> && ::std::is_move_constructible_v<_Val> && ::std::is_move_assignable_v<_Val> && !::std::is_copy_constructible_v<_Val> && !::std::is_copy_assignable_v<_Val>; | ||
if constexpr (_IsMoveOnly) { | ||
return ::std::forward<_Val>(__val); | ||
} | ||
else { | ||
return __val; | ||
} | ||
} | ||
|
||
} // namespace __txt_detail | ||
|
||
ZTD_TEXT_INLINE_ABI_NAMESPACE_CLOSE_I_ | ||
}} // namespace ztd::text | ||
|
||
#include <ztd/epilogue.hpp> | ||
|
||
#endif // ZT_TEXT_DETAIL_FORWARD_IF_MOVE_ONLY_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.