Skip to content

Commit

Permalink
Small fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeMirzayanov committed Jul 21, 2018
1 parent e471493 commit 33ed434
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions testlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* Copyright (c) 2005-2018
*/

#define VERSION "0.9.18"
#define VERSION "0.9.19"

/*
* Mike Mirzayanov
Expand Down Expand Up @@ -63,6 +63,9 @@
*/

const char* latestFeatures[] = {
"Batch of println functions (support collections, iterator ranges)",
"Introduced rnd.perm(size, first = 0) to generate a `first`-indexed permutation",
"Allow any whitespace in readInts-like functions for non-validators",
"Ignore 4+ command line arguments ifdef EJUDGE",
"Speed up of vtos",
"Show line number in validators in case of incorrect format",
Expand Down Expand Up @@ -4518,7 +4521,7 @@ void __println_range(A begin, B end)
std::cout << std::endl;
}

template<class T>
template<class T, class Enable = void>
struct is_iterator
{
static T makeT();
Expand All @@ -4529,6 +4532,12 @@ struct is_iterator
static const bool value = sizeof(test(makeT())) == sizeof(void *);
};

template<class T>
struct is_iterator<T, typename __testlib_enable_if<std::is_array<T>::value >::type>
{
static const bool value = false;
};

template <typename A, typename B>
typename __testlib_enable_if<!is_iterator<B>::value, void>::type println(const A& a, const B& b)
{
Expand All @@ -4550,6 +4559,15 @@ void println(const A* a, const A* b)
__println_range(a, b);
}

template <>
void println<char>(const char* a, const char* b)
{
__testlib_print_one(a);
std::cout << " ";
__testlib_print_one(b);
std::cout << std::endl;
}

template<typename T>
void println(const T& x)
{
Expand Down

0 comments on commit 33ed434

Please sign in to comment.