Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
composable_kernel
Commits
78f72412
Commit
78f72412
authored
Sep 14, 2022
by
Po-Yen, Chen
Browse files
Add check for range types
parent
515b4c8d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
example/37_permute/common.hpp
example/37_permute/common.hpp
+7
-1
No files found.
example/37_permute/common.hpp
View file @
78f72412
...
@@ -157,7 +157,9 @@ struct is_range : std::false_type
...
@@ -157,7 +157,9 @@ struct is_range : std::false_type
template
<
typename
T
>
template
<
typename
T
>
struct
is_range
<
T
,
struct
is_range
<
T
,
std
::
void_t
<
decltype
(
begin
(
std
::
declval
<
T
>
())),
decltype
(
end
(
std
::
declval
<
T
>
()))
>>
std
::
void_t
<
decltype
(
begin
(
std
::
declval
<
T
>
())),
decltype
(
end
(
std
::
declval
<
T
>
())),
decltype
(
begin
(
std
::
declval
<
T
>
())
!=
end
(
std
::
declval
<
T
>
()))
>>
:
std
::
bool_constant
<
is_iterator_v
<
ck
::
remove_cvref_t
<
decltype
(
begin
(
std
::
declval
<
T
>
()))
>>>
:
std
::
bool_constant
<
is_iterator_v
<
ck
::
remove_cvref_t
<
decltype
(
begin
(
std
::
declval
<
T
>
()))
>>>
{
{
};
};
...
@@ -214,6 +216,8 @@ inline constexpr bool is_random_access_range_v = is_random_access_range<Range>::
...
@@ -214,6 +216,8 @@ inline constexpr bool is_random_access_range_v = is_random_access_range<Range>::
template
<
typename
Range
>
template
<
typename
Range
>
class
to_array_proxy
class
to_array_proxy
{
{
static_assert
(
is_range_v
<
Range
>
);
public:
public:
explicit
to_array_proxy
(
const
Range
&
source
)
noexcept
:
source_
(
source
)
{}
explicit
to_array_proxy
(
const
Range
&
source
)
noexcept
:
source_
(
source
)
{}
...
@@ -237,6 +241,8 @@ class to_array_proxy
...
@@ -237,6 +241,8 @@ class to_array_proxy
template
<
typename
Range
>
template
<
typename
Range
>
inline
auto
to_array
(
Range
&
range
)
noexcept
inline
auto
to_array
(
Range
&
range
)
noexcept
->
std
::
enable_if_t
<
detail
::
is_range_v
<
Range
>
,
detail
::
to_array_proxy
<
ck
::
remove_cvref_t
<
Range
>>>
{
{
return
detail
::
to_array_proxy
<
ck
::
remove_cvref_t
<
Range
>>
{
range
};
return
detail
::
to_array_proxy
<
ck
::
remove_cvref_t
<
Range
>>
{
range
};
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment