Compare commits
No commits in common. "3deeedc7aa91242f0167a6b64dabe321b27bf628" and "b71ef30f3e8cb35238c27a1c055beceb88b7a19d" have entirely different histories.
3deeedc7aa
...
b71ef30f3e
@ -1,10 +0,0 @@
|
||||
#include "../vmake.hpp"
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
vmake::outputln_n(cout, 1000, " ", vmake::filter(
|
||||
vmake::rng::uniform_ints(vmake::require_unique, 1, 10000),
|
||||
[](auto x) { return x % 2 == 0; }));
|
||||
}
|
||||
|
@ -19,6 +19,24 @@ struct sequence_terminated_error : std::exception {
|
||||
}
|
||||
};
|
||||
|
||||
namespace details {
|
||||
|
||||
template<typename T>
|
||||
auto is_sequence_helper(char) -> decltype(
|
||||
std::declval<T>()()
|
||||
, std::declval<T>().is_terminated()
|
||||
, typename std::enable_if<std::is_same<decltype(std::declval<T>()())
|
||||
, typename T::result>::value, int>::type()
|
||||
, std::true_type{});
|
||||
|
||||
template<typename T>
|
||||
auto is_sequence_helper(int) -> std::false_type;
|
||||
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
using is_sequence_t = decltype(details::is_sequence_helper<T>(' '));
|
||||
|
||||
namespace polyfill {
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
@ -57,26 +75,6 @@ decltype(auto) apply(Func &&f, Tuple &&t) {
|
||||
|
||||
namespace details {
|
||||
|
||||
template<typename T>
|
||||
auto is_sequence_helper(char) -> decltype(
|
||||
std::declval<T>()()
|
||||
, typename std::enable_if<std::is_same<decltype(
|
||||
std::declval<typename polyfill::add_const_t<T>::type>().is_terminated())
|
||||
, bool>::value, int>::type{0}
|
||||
, typename std::enable_if<std::is_same<decltype(std::declval<T>()())
|
||||
, typename T::result>::value, int>::type{0}
|
||||
, std::true_type{});
|
||||
|
||||
template<typename T>
|
||||
auto is_sequence_helper(int) -> std::false_type;
|
||||
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
using is_sequence_t = decltype(details::is_sequence_helper<T>(' '));
|
||||
|
||||
namespace details {
|
||||
|
||||
template<typename T>
|
||||
struct iota_sequence {
|
||||
using result = T;
|
||||
@ -610,7 +608,7 @@ struct unique_ints_sequence {
|
||||
}
|
||||
|
||||
auto operator()() {
|
||||
if (!halfed && (used.size() + 1) * 2 - (r - l + 1) >= 0) {
|
||||
if (!halfed && Tval{(used.size() + 1) * 2} >= r - l + 1) {
|
||||
for (Tval i = l; i <= r; ++i) {
|
||||
if (!used.count(i)) rest.push_back(i);
|
||||
}
|
||||
@ -743,7 +741,6 @@ namespace _checks {
|
||||
|
||||
using empty_sequence_int = decltype(nothing<int>());
|
||||
|
||||
/*
|
||||
static_assert(is_sequence_t<empty_sequence_int>::value
|
||||
&& is_sequence_t<decltype(take(empty_sequence_int{}, 1))>::value
|
||||
&& is_sequence_t<decltype(group<20>(empty_sequence_int{}))>::value
|
||||
@ -751,7 +748,7 @@ static_assert(is_sequence_t<empty_sequence_int>::value
|
||||
&& !is_sequence_t<int>::value
|
||||
&& !is_sequence_t<std::less<int>>::value
|
||||
, "compile-time self-checking failed(try upgrading your compiler).");
|
||||
*/
|
||||
|
||||
} // namespace _checks
|
||||
|
||||
} // namespace vmake
|
||||
|
Loading…
x
Reference in New Issue
Block a user