41
41
#define PROGRAMOPTIONS_ASSERT (Expression, Message )\
42
42
do {\
43
43
if (!(Expression))\
44
- throw std::logic_error{ ( " ProgramOptions.hxx:" + std::to_string (__LINE__) + " : " ) + (Message) } ;\
44
+ throw std::logic_error (( " ProgramOptions.hxx:" + std::to_string (__LINE__) + " : " ) + (Message)) ;\
45
45
} while (0 )
46
46
#else // PROGRAMOPTIONS_EXCEPTIONS
47
47
#ifdef PROGRAMOPTIONS_DEBUG
@@ -106,7 +106,7 @@ namespace po {
106
106
#endif // PROGRAMOPTIONS_WINDOWS
107
107
108
108
color_resetter (std::ostream& stream, color_t color)
109
- : m_stream(stream) { // don't use an initializer list here because of gcc-4.8.5
109
+ : m_stream(stream) {
110
110
#ifdef PROGRAMOPTIONS_WINDOWS
111
111
m_stream << std::flush;
112
112
m_console = GetStdHandle (STD_OUTPUT_HANDLE);
@@ -211,7 +211,7 @@ namespace po {
211
211
// Compatibility stuff for the lack of C++14 support
212
212
template <typename T, typename ... args_t >
213
213
std::unique_ptr<T> make_unique (args_t &&... args) {
214
- return std::unique_ptr<T>{ new T{ std::forward<args_t >(args)... } } ;
214
+ return std::unique_ptr<T>( new T ( std::forward<args_t >(args)...)) ;
215
215
}
216
216
217
217
template <typename T, T... i>
@@ -291,7 +291,7 @@ namespace po {
291
291
292
292
public:
293
293
explicit repeat (std::size_t count, char character)
294
- : m_count{ count } , m_character{ character } {
294
+ : m_count( count) , m_character( character) {
295
295
}
296
296
297
297
friend std::ostream& operator <<(std::ostream& stream, repeat const & object) {
@@ -419,7 +419,7 @@ namespace po {
419
419
template <typename T>
420
420
T pow (T base, int exp) {
421
421
const T result = pow (base, static_cast <unsigned >(std::abs (exp)));
422
- return exp >= 0 ? result : T{ 1 } / result;
422
+ return exp >= 0 ? result : T ( 1 ) / result;
423
423
}
424
424
425
425
template <typename T, unsigned i>
@@ -449,17 +449,17 @@ namespace po {
449
449
template <typename T>
450
450
struct parsing_report {
451
451
error_code error = error_code::none;
452
- const T value{};
452
+ T value; // should be optional
453
453
454
454
parsing_report () = default ;
455
455
parsing_report (error_code error)
456
- : error{ error } {
456
+ : error( error) {
457
457
}
458
458
parsing_report (T const & value)
459
- : value{ value } {
459
+ : value( value) {
460
460
}
461
461
parsing_report (T&& value)
462
- : value{ std::move (value) } {
462
+ : value( std::move(value)) {
463
463
}
464
464
465
465
bool good () const {
@@ -523,7 +523,7 @@ namespace po {
523
523
}
524
524
template <typename forward_iterator_t , typename ... args_t >
525
525
bool expect (forward_iterator_t & first, forward_iterator_t last, args_t &&... args) {
526
- forward_iterator_t first_copy{ first } ;
526
+ forward_iterator_t first_copy ( first) ;
527
527
const bool result = detail::expect_impl (first_copy, last, std::forward<args_t >(args)...);
528
528
if (result)
529
529
first = first_copy;
@@ -604,7 +604,7 @@ namespace po {
604
604
if (decimals >= max_decimals)
605
605
if (decimals > max_decimals || exp > max)
606
606
return error_code::out_of_range;
607
- const T fac = pow (T{ 10 } , exp);
607
+ const T fac = pow (T ( 10 ) , exp);
608
608
const T mant = result;
609
609
result *= fac;
610
610
if (result / fac != mant)
@@ -771,10 +771,10 @@ namespace po {
771
771
772
772
value () = default ;
773
773
explicit value (string_t const & object)
774
- : string{ object } {
774
+ : string( object) {
775
775
}
776
776
explicit value (string_t && object)
777
- : string{ std::move (object) } {
777
+ : string( std::move(object)) {
778
778
}
779
779
};
780
780
@@ -906,7 +906,7 @@ namespace po {
906
906
public:
907
907
template <typename ... args_t >
908
908
explicit callback_storage (args_t &&... args)
909
- : m_invocable{ std::forward<args_t >(args)... } {
909
+ : m_invocable( std::forward<args_t >(args)...) {
910
910
}
911
911
};
912
912
@@ -1116,7 +1116,7 @@ namespace po {
1116
1116
value_iterator () {
1117
1117
}
1118
1118
explicit value_iterator (underlying_t const & underlying)
1119
- : m_underlying{ underlying } {
1119
+ : m_underlying( underlying) {
1120
1120
}
1121
1121
1122
1122
reference operator *() const {
@@ -1150,7 +1150,7 @@ namespace po {
1150
1150
return *this ;
1151
1151
}
1152
1152
value_iterator operator ++(int ) {
1153
- value_iterator result{ *this } ;
1153
+ value_iterator result ( *this ) ;
1154
1154
++*this ;
1155
1155
return result;
1156
1156
}
@@ -1159,7 +1159,7 @@ namespace po {
1159
1159
return *this ;
1160
1160
}
1161
1161
value_iterator operator --(int ) {
1162
- value_iterator result{ *this } ;
1162
+ value_iterator result ( *this ) ;
1163
1163
--*this ;
1164
1164
return result;
1165
1165
}
@@ -1339,7 +1339,7 @@ namespace po {
1339
1339
return result;
1340
1340
}
1341
1341
parsing_report<value> make_value (std::string const & str) const {
1342
- return make_value (std::string{ str } );
1342
+ return make_value (std::string ( str) );
1343
1343
}
1344
1344
template <typename T>
1345
1345
parsing_report<value> make_value (T const & integer, typename std::enable_if<std::is_integral<T>::value>::type* = nullptr ) const {
@@ -1468,7 +1468,7 @@ namespace po {
1468
1468
return begin ();
1469
1469
}
1470
1470
reverse_iterator rbegin () const {
1471
- return reverse_iterator{ end () } ;
1471
+ return reverse_iterator ( end ()) ;
1472
1472
}
1473
1473
const_reverse_iterator crbegin () const {
1474
1474
return rbegin ();
@@ -1484,7 +1484,7 @@ namespace po {
1484
1484
return end ();
1485
1485
}
1486
1486
reverse_iterator rend () const {
1487
- return reverse_iterator{ begin () } ;
1487
+ return reverse_iterator ( begin ()) ;
1488
1488
}
1489
1489
const_reverse_iterator crend () const {
1490
1490
return rend ();
@@ -1493,15 +1493,15 @@ namespace po {
1493
1493
template <value_type type>
1494
1494
value_iterator<type, iterator> begin () const {
1495
1495
assert_iterator_type<type>();
1496
- return value_iterator<type, iterator>{ begin () } ;
1496
+ return value_iterator<type, iterator>( begin ()) ;
1497
1497
}
1498
1498
template <value_type type>
1499
1499
value_iterator<type, iterator> cbegin () const {
1500
1500
return begin<type>();
1501
1501
}
1502
1502
template <value_type type>
1503
1503
std::reverse_iterator<value_iterator<type, iterator>> rbegin () const {
1504
- return std::reverse_iterator<value_iterator<type, iterator>>{ end<type>() } ;
1504
+ return std::reverse_iterator<value_iterator<type, iterator>>( end<type>()) ;
1505
1505
}
1506
1506
template <value_type type>
1507
1507
std::reverse_iterator<value_iterator<type, iterator>> crbegin () const {
@@ -1511,15 +1511,15 @@ namespace po {
1511
1511
template <value_type type>
1512
1512
value_iterator<type, iterator> end () const {
1513
1513
assert_iterator_type<type>();
1514
- return value_iterator<type, iterator>{ end () } ;
1514
+ return value_iterator<type, iterator>( end ()) ;
1515
1515
}
1516
1516
template <value_type type>
1517
1517
value_iterator<type, iterator> cend () const {
1518
1518
return end<type>();
1519
1519
}
1520
1520
template <value_type type>
1521
1521
std::reverse_iterator<value_iterator<type, iterator>> rend () const {
1522
- return std::reverse_iterator<value_iterator<type, iterator>>{ begin<type>() } ;
1522
+ return std::reverse_iterator<value_iterator<type, iterator>>( begin<type>()) ;
1523
1523
}
1524
1524
template <value_type type>
1525
1525
std::reverse_iterator<value_iterator<type, iterator>> crend () const {
@@ -2005,7 +2005,7 @@ namespace po {
2005
2005
<< error ()
2006
2006
<< " unexpected character \' " << argv[i][j] << " \' "
2007
2007
<< ignoring (argv[i])
2008
- << suggest (std::string{ &argv[i][0 ], &argv[i][j] } + " =" + std::string{ &argv[i][j] } ) << ' \n ' ;
2008
+ << suggest (std::string ( &argv[i][0 ], &argv[i][j]) + " =" + &argv[i][j]) << ' \n ' ;
2009
2009
return false ;
2010
2010
}
2011
2011
return parse_argument (option, std::move (expression), argument);
@@ -2093,7 +2093,7 @@ namespace po {
2093
2093
*m_output_destination << ' \n ' ;
2094
2094
}
2095
2095
} else {
2096
- const auto opt = m_options.find (std::string{ first, last } );
2096
+ const auto opt = m_options.find (std::string ( first, last) );
2097
2097
if (opt == m_options.end ()) {
2098
2098
good = false ;
2099
2099
if (is_verbose ()) {
@@ -2192,7 +2192,7 @@ namespace po {
2192
2192
2193
2193
public:
2194
2194
option& operator [](std::string const & designator) {
2195
- return operator_brackets_helper (std::string{ designator } );
2195
+ return operator_brackets_helper (std::string ( designator) );
2196
2196
}
2197
2197
option& operator [](std::string&& designator) {
2198
2198
return operator_brackets_helper (std::move (designator));
@@ -2250,26 +2250,26 @@ namespace po {
2250
2250
auto & opt = **iter;
2251
2251
if (opt.first .empty ())
2252
2252
continue ;
2253
- stream << repeat{ left_padding, ' ' } ;
2253
+ stream << repeat ( left_padding, ' ' ) ;
2254
2254
const char abbreviation = opt.second .get_abbreviation ();
2255
2255
const bool verbose = opt.first .size () > 1 ;
2256
2256
if (abbreviation)
2257
2257
stream << white << ' -' << abbreviation;
2258
2258
else
2259
- stream << repeat{ abbreviation_width, ' ' } ;
2259
+ stream << repeat ( abbreviation_width, ' ' ) ;
2260
2260
if (abbreviation && verbose)
2261
2261
stream << ' ,' << ' ' ;
2262
2262
else
2263
- stream << repeat{ separator_width, ' ' } ;
2263
+ stream << repeat ( separator_width, ' ' ) ;
2264
2264
if (verbose) {
2265
2265
stream << white << ' -' << ' -' << opt.first ;
2266
2266
const int rem = static_cast <int >(verbose_width) - 2 - static_cast <int >(opt.first .size ());
2267
2267
if (rem >= 0 )
2268
- stream << repeat{ static_cast <std::size_t >(rem) + mid_padding, ' ' } ;
2268
+ stream << repeat ( static_cast <std::size_t >(rem) + mid_padding, ' ' ) ;
2269
2269
else
2270
- stream << ' \n ' << repeat{ description_start, ' ' } ;
2270
+ stream << ' \n ' << repeat ( description_start, ' ' ) ;
2271
2271
} else {
2272
- stream << repeat{ verbose_width + mid_padding, ' ' } ;
2272
+ stream << repeat ( verbose_width + mid_padding, ' ' ) ;
2273
2273
}
2274
2274
std::size_t carriage = description_start;
2275
2275
std::string const & descr = opt.second .get_description ();
@@ -2287,7 +2287,7 @@ namespace po {
2287
2287
}
2288
2288
if (descr[i] == ' \n ' || last) {
2289
2289
carriage = description_start + paragraph_indenture;
2290
- stream << ' \n ' << repeat{ carriage, ' ' } ;
2290
+ stream << ' \n ' << repeat ( carriage, ' ' ) ;
2291
2291
if (std::isblank (descr[i + 1 ]))
2292
2292
++i;
2293
2293
} else {
0 commit comments