Skip to content

Commit cf2de8a

Browse files
committed
slightly reformat code
1 parent fe4aa54 commit cf2de8a

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

libchecktestdata.cc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ class doesnt_match_exception {};
4141
class eof_found_exception {};
4242
class generate_exception {};
4343

44-
const int display_before_error = 65;
45-
const int display_after_error = 50;
44+
constexpr int display_before_error = 65;
45+
constexpr int display_after_error = 50;
4646

4747
size_t prognr;
4848
const command *currcmd;
@@ -63,8 +63,8 @@ vector<command> program;
6363
// This stores array-type variables like x[i,j] as string "x" and
6464
// vector of the indices. Plain variables are stored using an index
6565
// vector of zero length.
66-
typedef map<vector<bigint>,value_t> indexmap;
67-
typedef map<value_t,set<vector<bigint>>> valuemap;
66+
using indexmap = map<vector<bigint>,value_t>;
67+
using valuemap = map<value_t,set<vector<bigint>>>;
6868
map<string,indexmap> variable, preset;
6969
map<string,valuemap> rev_variable, rev_preset;
7070

@@ -322,11 +322,11 @@ value_t value(const expr& x)
322322

323323
template<class A, class B>
324324
struct arith_result {
325-
typedef typename conditional<
325+
using type = typename conditional<
326326
is_same<A,bigint>::value && is_same<B,bigint>::value,
327327
bigint,
328328
mpf_class
329-
>::type type;
329+
>::type;
330330
};
331331

332332
template<class A, class B> struct arith_compatible {
@@ -352,7 +352,7 @@ struct arithmetic_##name : public boost::static_visitor<value_t> {\
352352
}\
353353
template<class A, class B, typename enable_if<arith_compatible<A,B>::value,int>::type = 0,\
354354
class C = typename arith_result<A,B>::type>\
355-
value_t operator()(const A& a, const B& b)const {\
355+
value_t operator()(const A& a, const B& b)const {\
356356
return value_t(C(a op b));\
357357
}\
358358
};\
@@ -364,12 +364,12 @@ value_t operator op(const value_t &x, const value_t &y) \
364364
#define DECL_VALUE_CMPOP(op,name) \
365365
struct arithmetic_##name : public boost::static_visitor<bool> {\
366366
template<class A, class B, typename enable_if<!is_comparable<A,B>::value,int>::type = 0>\
367-
bool operator()(const A& a, const B& b)const {\
367+
bool operator()(const A& a, const B& b)const {\
368368
cerr << "cannot compute " << a << " " #op " " << b << endl; \
369369
exit(exit_failure);\
370370
}\
371371
template<class A, class B, typename enable_if<is_comparable<A,B>::value,int>::type = 0>\
372-
bool operator()(const A& a, const B& b)const {\
372+
bool operator()(const A& a, const B& b)const {\
373373
return a op b;\
374374
}\
375375
};\

libchecktestdata.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99

1010
namespace checktestdata {
1111

12-
const int exit_failure = 2;
12+
constexpr int exit_failure = 2;
1313

14-
const int opt_whitespace_ok = 1; // ignore additional whitespace
15-
const int opt_quiet = 2; // quiet execution: only return status
16-
const int opt_debugging = 4; // print additional debugging statements
14+
constexpr int opt_whitespace_ok = 1; // ignore additional whitespace
15+
constexpr int opt_quiet = 2; // quiet execution: only return status
16+
constexpr int opt_debugging = 4; // print additional debugging statements
1717

18-
const int float_precision = 15; // output precision (digits) of floats
18+
constexpr int float_precision = 15; // output precision (digits) of floats
1919

2020
void init_checktestdata(std::istream &progstream, int opt_mask = 0, long seed = -1);
2121
/* Initialize libchecktestdata by loading syntax from progstream and

0 commit comments

Comments
 (0)