@@ -295,13 +295,12 @@ struct valid_value_or_string_convertible
295295};
296296
297297template <class T >
298- struct value_traits <T, typename std::
299- enable_if<valid_value_or_string_convertible<T>::
300- value>::type>
298+ struct value_traits <T, typename std::enable_if<
299+ valid_value_or_string_convertible<T>::value>::type>
301300{
302- using value_type = typename std::
303- conditional< valid_value<typename std::decay<T>::type>::value,
304- typename std::decay<T>::type, std::string>::type;
301+ using value_type = typename std::conditional<
302+ valid_value<typename std::decay<T>::type>::value,
303+ typename std::decay<T>::type, std::string>::type;
305304
306305 using type = value<value_type>;
307306
@@ -312,12 +311,11 @@ struct value_traits<T, typename std::
312311};
313312
314313template <class T >
315- struct value_traits <T,
316- typename std::
317- enable_if<!valid_value_or_string_convertible<T>::value
318- && std::is_floating_point<
319- typename std::decay<T>::type>::value>::
320- type>
314+ struct value_traits <
315+ T,
316+ typename std::enable_if<
317+ !valid_value_or_string_convertible<T>::value
318+ && std::is_floating_point<typename std::decay<T>::type>::value>::type>
321319{
322320 using value_type = typename std::decay<T>::type;
323321
@@ -330,11 +328,10 @@ struct value_traits<T,
330328};
331329
332330template <class T >
333- struct value_traits <T,
334- typename std::
335- enable_if<!valid_value_or_string_convertible<T>::value
336- && std::is_signed<typename std::decay<T>::
337- type>::value>::type>
331+ struct value_traits <
332+ T, typename std::enable_if<
333+ !valid_value_or_string_convertible<T>::value
334+ && std::is_signed<typename std::decay<T>::type>::value>::type>
338335{
339336 using value_type = int64_t ;
340337
@@ -356,11 +353,10 @@ struct value_traits<T,
356353};
357354
358355template <class T >
359- struct value_traits <T,
360- typename std::
361- enable_if<!valid_value_or_string_convertible<T>::value
362- && std::is_unsigned<typename std::decay<T>::
363- type>::value>::type>
356+ struct value_traits <
357+ T, typename std::enable_if<
358+ !valid_value_or_string_convertible<T>::value
359+ && std::is_unsigned<typename std::decay<T>::type>::value>::type>
364360{
365361 using value_type = int64_t ;
366362
@@ -576,7 +572,7 @@ class base : public std::enable_shared_from_this<base>
576572#if defined(CPPTOML_NO_RTTI)
577573 base_type type () const
578574 {
579- return type_;
575+ return type_;
580576 }
581577
582578 protected:
@@ -698,7 +694,7 @@ inline std::shared_ptr<value<double>> base::as()
698694 if (type () == base_type::INT)
699695 {
700696 auto v = std::static_pointer_cast<value<int64_t >>(shared_from_this ());
701- return make_value<double >(static_cast <double >(v->get ()));;
697+ return make_value<double >(static_cast <double >(v->get ()));
702698 }
703699#else
704700 if (auto v = std::dynamic_pointer_cast<value<double >>(shared_from_this ()))
@@ -731,7 +727,8 @@ inline std::shared_ptr<const value<double>> base::as() const
731727{
732728#if defined(CPPTOML_NO_RTTI)
733729 if (type () == base_type::FLOAT)
734- return std::static_pointer_cast<const value<double >>(shared_from_this ());
730+ return std::static_pointer_cast<const value<double >>(
731+ shared_from_this ());
735732
736733 if (type () == base_type::INT)
737734 {
@@ -1830,7 +1827,7 @@ inline std::istream& getline(std::istream& input, std::string& line)
18301827 line.push_back (static_cast <char >(c));
18311828 }
18321829}
1833- }
1830+ } // namespace detail
18341831
18351832/* *
18361833 * The parser class.
@@ -1945,7 +1942,6 @@ class parser
19451942 curr_table->insert (part, make_table ());
19461943 curr_table = static_cast <table*>(curr_table->get (part).get ());
19471944 }
1948-
19491945 };
19501946
19511947 key_part_handler (parse_key (it, end, key_end, key_part_handler));
@@ -1976,8 +1972,9 @@ class parser
19761972 // since it has already been defined. If there aren't any
19771973 // values, then it was implicitly created by something like
19781974 // [a.b]
1979- if (curr_table->empty () || std::any_of (curr_table->begin (),
1980- curr_table->end (), is_value))
1975+ if (curr_table->empty ()
1976+ || std::any_of (curr_table->begin (), curr_table->end (),
1977+ is_value))
19811978 {
19821979 throw_parse_exception (" Redefinition of table "
19831980 + full_table_name);
@@ -1996,12 +1993,10 @@ class parser
19961993 if (it == end || *it == ' ]' )
19971994 throw_parse_exception (" Table array name cannot be empty" );
19981995
1999-
20001996 auto key_end = [](char c) { return c == ' ]' ; };
20011997
20021998 std::string full_ta_name;
2003- auto key_part_handler = [&](const std::string& part)
2004- {
1999+ auto key_part_handler = [&](const std::string& part) {
20052000 if (part.empty ())
20062001 throw_parse_exception (" Empty component of table array name" );
20072002
@@ -2257,7 +2252,7 @@ class parser
22572252 parse_type determine_value_type (const std::string::iterator& it,
22582253 const std::string::iterator& end)
22592254 {
2260- if (it == end)
2255+ if (it == end)
22612256 {
22622257 throw_parse_exception (" Failed to parse value type" );
22632258 }
@@ -2586,8 +2581,9 @@ class parser
25862581 {
25872582 if (is_number (c))
25882583 return static_cast <uint32_t >(c - ' 0' );
2589- return 10 + static_cast <uint32_t >(
2590- c - ((c >= ' a' && c <= ' f' ) ? ' a' : ' A' ));
2584+ return 10
2585+ + static_cast <uint32_t >(c
2586+ - ((c >= ' a' && c <= ' f' ) ? ' a' : ' A' ));
25912587 }
25922588
25932589 std::shared_ptr<base> parse_number (std::string::iterator& it,
@@ -3350,9 +3346,9 @@ class toml_writer
33503346 * offset_datetime.
33513347 */
33523348 template <class T >
3353- typename std::enable_if<is_one_of<T, int64_t , local_date, local_time,
3354- local_datetime,
3355- offset_datetime>::value>::type
3349+ typename std::enable_if<
3350+ is_one_of<T, int64_t , local_date, local_time, local_datetime,
3351+ offset_datetime>::value>::type
33563352 write (const value<T>& v)
33573353 {
33583354 write (v.get ());
@@ -3516,5 +3512,5 @@ inline std::ostream& operator<<(std::ostream& stream, const array& a)
35163512 a.accept (writer);
35173513 return stream;
35183514}
3519- }
3515+ } // namespace cpptoml
35203516#endif
0 commit comments