@@ -481,14 +481,11 @@ namespace detail {
481481 {
482482 return Json (-val.template as <int64_t >(), semantic_tag::none);
483483 }
484- else if (val.is_double ())
484+ if (val.is_double ())
485485 {
486486 return Json (-val.as_double (), semantic_tag::none);
487487 }
488- else
489- {
490- return Json::null ();
491- }
488+ return Json::null ();
492489 }
493490 };
494491
@@ -546,9 +543,6 @@ namespace detail {
546543 {
547544 return " binary operator" ;
548545 }
549-
550- protected:
551- ~binary_operator () = default ;
552546 };
553547
554548 // Implementations
@@ -609,10 +603,7 @@ namespace detail {
609603 {
610604 return rhs;
611605 }
612- else
613- {
614- return lhs;
615- }
606+ return lhs;
616607 }
617608
618609 std::string to_string (int level) const override
@@ -703,7 +694,7 @@ namespace detail {
703694 {
704695 return lhs < rhs ? Json (true , semantic_tag::none) : Json (false , semantic_tag::none);
705696 }
706- else if (lhs.is_string () && rhs.is_string ())
697+ if (lhs.is_string () && rhs.is_string ())
707698 {
708699 return lhs < rhs ? Json (true , semantic_tag::none) : Json (false , semantic_tag::none);
709700 }
@@ -740,7 +731,7 @@ namespace detail {
740731 {
741732 return lhs <= rhs ? Json (true , semantic_tag::none) : Json (false , semantic_tag::none);
742733 }
743- else if (lhs.is_string () && rhs.is_string ())
734+ if (lhs.is_string () && rhs.is_string ())
744735 {
745736 return lhs <= rhs ? Json (true , semantic_tag::none) : Json (false , semantic_tag::none);
746737 }
@@ -779,7 +770,7 @@ namespace detail {
779770 {
780771 return lhs > rhs ? Json (true , semantic_tag::none) : Json (false , semantic_tag::none);
781772 }
782- else if (lhs.is_string () && rhs.is_string ())
773+ if (lhs.is_string () && rhs.is_string ())
783774 {
784775 return lhs > rhs ? Json (true , semantic_tag::none) : Json (false , semantic_tag::none);
785776 }
@@ -816,7 +807,7 @@ namespace detail {
816807 {
817808 return lhs >= rhs ? Json (true , semantic_tag::none) : Json (false , semantic_tag::none);
818809 }
819- else if (lhs.is_string () && rhs.is_string ())
810+ if (lhs.is_string () && rhs.is_string ())
820811 {
821812 return lhs >= rhs ? Json (true , semantic_tag::none) : Json (false , semantic_tag::none);
822813 }
@@ -853,18 +844,15 @@ namespace detail {
853844 {
854845 return Json::null ();
855846 }
856- else if (lhs.is_int64 () && rhs.is_int64 ())
847+ if (lhs.is_int64 () && rhs.is_int64 ())
857848 {
858849 return Json (((lhs.template as <int64_t >() + rhs.template as <int64_t >())), semantic_tag::none);
859850 }
860- else if (lhs.is_uint64 () && rhs.is_uint64 ())
851+ if (lhs.is_uint64 () && rhs.is_uint64 ())
861852 {
862853 return Json ((lhs.template as <uint64_t >() + rhs.template as <uint64_t >()), semantic_tag::none);
863854 }
864- else
865- {
866- return Json ((lhs.as_double () + rhs.as_double ()), semantic_tag::none);
867- }
855+ return Json ((lhs.as_double () + rhs.as_double ()), semantic_tag::none);
868856 }
869857
870858 std::string to_string (int level) const override
@@ -897,18 +885,15 @@ namespace detail {
897885 {
898886 return Json::null ();
899887 }
900- else if (lhs.is_int64 () && rhs.is_int64 ())
888+ if (lhs.is_int64 () && rhs.is_int64 ())
901889 {
902890 return Json (((lhs.template as <int64_t >() - rhs.template as <int64_t >())), semantic_tag::none);
903891 }
904- else if (lhs.is_uint64 () && rhs.is_uint64 ())
892+ if (lhs.is_uint64 () && rhs.is_uint64 ())
905893 {
906894 return Json ((lhs.template as <uint64_t >() - rhs.template as <uint64_t >()), semantic_tag::none);
907895 }
908- else
909- {
910- return Json ((lhs.as_double () - rhs.as_double ()), semantic_tag::none);
911- }
896+ return Json ((lhs.as_double () - rhs.as_double ()), semantic_tag::none);
912897 }
913898
914899 std::string to_string (int level) const override
@@ -941,18 +926,15 @@ namespace detail {
941926 {
942927 return Json::null ();
943928 }
944- else if (lhs.is_int64 () && rhs.is_int64 ())
929+ if (lhs.is_int64 () && rhs.is_int64 ())
945930 {
946931 return Json (((lhs.template as <int64_t >() * rhs.template as <int64_t >())), semantic_tag::none);
947932 }
948- else if (lhs.is_uint64 () && rhs.is_uint64 ())
933+ if (lhs.is_uint64 () && rhs.is_uint64 ())
949934 {
950935 return Json ((lhs.template as <uint64_t >() * rhs.template as <uint64_t >()), semantic_tag::none);
951936 }
952- else
953- {
954- return Json ((lhs.as_double () * rhs.as_double ()), semantic_tag::none);
955- }
937+ return Json ((lhs.as_double () * rhs.as_double ()), semantic_tag::none);
956938 }
957939
958940 std::string to_string (int level) const override
@@ -987,18 +969,15 @@ namespace detail {
987969 {
988970 return Json::null ();
989971 }
990- else if (lhs.is_int64 () && rhs.is_int64 ())
972+ if (lhs.is_int64 () && rhs.is_int64 ())
991973 {
992974 return Json (((lhs.template as <int64_t >() / rhs.template as <int64_t >())), semantic_tag::none);
993975 }
994- else if (lhs.is_uint64 () && rhs.is_uint64 ())
976+ if (lhs.is_uint64 () && rhs.is_uint64 ())
995977 {
996978 return Json ((lhs.template as <uint64_t >() / rhs.template as <uint64_t >()), semantic_tag::none);
997979 }
998- else
999- {
1000- return Json ((lhs.as_double () / rhs.as_double ()), semantic_tag::none);
1001- }
980+ return Json ((lhs.as_double () / rhs.as_double ()), semantic_tag::none);
1002981 }
1003982
1004983 std::string to_string (int level) const override
@@ -1033,18 +1012,15 @@ namespace detail {
10331012 {
10341013 return Json::null ();
10351014 }
1036- else if (lhs.is_int64 () && rhs.is_int64 ())
1015+ if (lhs.is_int64 () && rhs.is_int64 ())
10371016 {
10381017 return Json (((lhs.template as <int64_t >() % rhs.template as <int64_t >())), semantic_tag::none);
10391018 }
1040- else if (lhs.is_uint64 () && rhs.is_uint64 ())
1019+ if (lhs.is_uint64 () && rhs.is_uint64 ())
10411020 {
10421021 return Json ((lhs.template as <uint64_t >() % rhs.template as <uint64_t >()), semantic_tag::none);
10431022 }
1044- else
1045- {
1046- return Json (fmod (lhs.as_double (), rhs.as_double ()), semantic_tag::none);
1047- }
1023+ return Json (fmod (lhs.as_double (), rhs.as_double ()), semantic_tag::none);
10481024 }
10491025
10501026 std::string to_string (int level) const override
@@ -1074,8 +1050,14 @@ namespace detail {
10741050 {
10751051 }
10761052
1053+ function_base (const function_base&) = default ;
1054+ function_base (function_base&&) = default ;
1055+
10771056 virtual ~function_base () noexcept = default ;
10781057
1058+ function_base& operator =(const function_base&) = default ;
1059+ function_base& operator =(function_base&&) = default ;
1060+
10791061 jsoncons::optional<std::size_t > arity () const
10801062 {
10811063 return arg_count_;
@@ -1232,10 +1214,7 @@ namespace detail {
12321214 {
12331215 return value_type (true , semantic_tag::none);
12341216 }
1235- else
1236- {
1237- return value_type (false , semantic_tag::none);
1238- }
1217+ return value_type (false , semantic_tag::none);
12391218 }
12401219
12411220 std::string to_string (int level) const override
@@ -1294,10 +1273,7 @@ namespace detail {
12941273 {
12951274 return value_type (true , semantic_tag::none);
12961275 }
1297- else
1298- {
1299- return value_type (false , semantic_tag::none);
1300- }
1276+ return value_type (false , semantic_tag::none);
13011277 }
13021278
13031279 std::string to_string (int level) const override
@@ -1590,7 +1566,7 @@ namespace detail {
15901566 {
15911567 return value_type (sn, semantic_tag::none);
15921568 }
1593- jsoncons::detail::chars_to to_double;
1569+ jsoncons::detail::chars_to to_double{} ;
15941570 try
15951571 {
15961572 auto s = arg0.as_string ();
@@ -2405,7 +2381,7 @@ namespace detail {
24052381 {
24062382 }
24072383
2408- virtual std::string to_string (int = 0 ) const
2384+ virtual std::string to_string (int ) const
24092385 {
24102386 return std::string ();
24112387 }
@@ -2528,15 +2504,9 @@ namespace detail {
25282504 ec = jsonpath_errc::unknown_function;
25292505 return nullptr ;
25302506 }
2531- else
2532- {
2533- return it2->second .get ();
2534- }
2535- }
2536- else
2537- {
2538- return it->second .get ();
2507+ return it2->second .get ();
25392508 }
2509+ return it->second .get ();
25402510 }
25412511
25422512 const unary_operator<Json>* get_unary_not () const
0 commit comments