Skip to content

Commit

Permalink
Fixed compilation in g++ (for std=c++03)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeMirzayanov committed Jul 23, 2018
1 parent 33ed434 commit b9d50d5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
4 changes: 1 addition & 3 deletions generators/bgen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ using namespace std;
int main(int argc, char* argv[])
{
registerGen(argc, argv, 1);

cout << rnd.next("[0000000001]{100}") << endl;

println(rnd.next("[0000000001]{100}"));
return 0;
}
5 changes: 2 additions & 3 deletions generators/gen-bipartite-graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,9 @@ int main(int argc, char* argv[])
pb[i] = i + 1;
shuffle(pb.begin(), pb.end());

cout << n << " " << m << " " << e.size() << endl;

println(n, m, e.size());
forn(i, e.size())
cout << pa[e[i].first] << " " << pb[e[i].second] << endl;
println(pa[e[i].first], pb[e[i].second]);

return 0;
}
19 changes: 18 additions & 1 deletion 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.19"
#define VERSION "0.9.20"

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

const char* latestFeatures[] = {
"Fixed compilation in g++ (for std=c++03)",
"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",
Expand Down Expand Up @@ -173,6 +174,7 @@ const char* latestFeatures[] = {
# define ON_WINDOWS
# if defined(_MSC_VER) && _MSC_VER>1400
# pragma warning( disable : 4127 )
# pragma warning( disable : 4146 )
# pragma warning( disable : 4458 )
# endif
#else
Expand Down Expand Up @@ -2236,6 +2238,7 @@ std::fstream tout;
/* implementation
*/

#if __cplusplus > 199711L || defined(_MSC_VER)
template<typename T>
static std::string vtos(const T& t, std::true_type)
{
Expand Down Expand Up @@ -2274,6 +2277,18 @@ static std::string vtos(const T& t)
{
return vtos(t, std::is_integral<T>());
}
#else
template<typename T>
static std::string vtos(const T& t)
{
std::string s;
static std::stringstream ss;
ss.str(std::string());
ss << t;
ss >> s;
return s;
}
#endif

template <typename T>
static std::string toString(const T& t)
Expand Down Expand Up @@ -4462,6 +4477,7 @@ NORETURN void expectedButFound<long double>(TResult result, long double expected

#endif

#if __cplusplus > 199711L || defined(_MSC_VER)
template <typename T>
struct is_iterable
{
Expand Down Expand Up @@ -4649,3 +4665,4 @@ void println(const A& a, const B& b, const C& c, const D& d, const E& e, const F
__testlib_print_one(g);
std::cout << std::endl;
}
#endif

0 comments on commit b9d50d5

Please sign in to comment.