@@ -64,7 +64,8 @@ namespace sol {
6464 struct has_erase_after_test {
6565 private:
6666 template <typename C>
67- static meta::sfinae_yes_t test (decltype (std::declval<C>().erase_after(std::declval<std::add_rvalue_reference_t <typename C::const_iterator>>()))*);
67+ static meta::sfinae_yes_t test (
68+ decltype (std::declval<C>().erase_after(std::declval<std::add_rvalue_reference_t <typename C::const_iterator>>()))*);
6869 template <typename C>
6970 static meta::sfinae_no_t test (...);
7071
@@ -404,7 +405,8 @@ namespace sol {
404405 }
405406
406407 static int index_set (lua_State* L) {
407- return luaL_error (L, " sol: cannot call 'container[key] = value' on type '%s': it is not recognized as a container" , detail::demangle<T>().c_str ());
408+ return luaL_error (
409+ L, " sol: cannot call 'container[key] = value' on type '%s': it is not recognized as a container" , detail::demangle<T>().c_str ());
408410 }
409411
410412 static int add (lua_State* L) {
@@ -463,7 +465,9 @@ namespace sol {
463465 };
464466
465467 template <typename X>
466- struct usertype_container_default <X, std::enable_if_t <meta::all<is_forced_container<meta::unqualified_t <X>>, meta::has_value_type<meta::unqualified_t <container_decay_t <X>>>, meta::has_iterator<meta::unqualified_t <container_decay_t <X>>>>::value>> {
468+ struct usertype_container_default <X,
469+ std::enable_if_t <meta::all<is_forced_container<meta::unqualified_t <X>>, meta::has_value_type<meta::unqualified_t <container_decay_t <X>>>,
470+ meta::has_iterator<meta::unqualified_t <container_decay_t <X>>>>::value>> {
467471 private:
468472 using T = std::remove_pointer_t <meta::unwrap_unqualified_t <container_decay_t <X>>>;
469473
@@ -475,32 +479,21 @@ namespace sol {
475479 using is_matched_lookup = meta::is_matched_lookup<T>;
476480 using iterator = typename T::iterator;
477481 using value_type = typename T::value_type;
478- typedef meta::conditional_t <is_matched_lookup::value,
479- std::pair<value_type, value_type>,
480- meta::conditional_t <is_associative::value || is_lookup::value,
481- value_type,
482- std::pair<std::ptrdiff_t , value_type>>>
483- KV;
482+ typedef meta::conditional_t <is_matched_lookup::value, std::pair<value_type, value_type>,
483+ meta::conditional_t <is_associative::value || is_lookup::value, value_type, std::pair<std::ptrdiff_t , value_type>>>
484+ KV;
484485 typedef typename KV::first_type K;
485486 typedef typename KV::second_type V;
486487 typedef meta::conditional_t <is_matched_lookup::value, std::ptrdiff_t , K> next_K;
487488 typedef decltype (*std::declval<iterator&>()) iterator_return;
488- typedef meta::conditional_t <is_associative::value || is_matched_lookup::value,
489- std::add_lvalue_reference_t <V>,
490- meta::conditional_t <is_lookup::value,
491- V,
492- iterator_return>>
493- captured_type;
489+ typedef meta::conditional_t <is_associative::value || is_matched_lookup::value, std::add_lvalue_reference_t <V>,
490+ meta::conditional_t <is_lookup::value, V, iterator_return>>
491+ captured_type;
494492 typedef typename meta::iterator_tag<iterator>::type iterator_category;
495493 typedef std::is_same<iterator_category, std::input_iterator_tag> is_input_iterator;
496- typedef meta::conditional_t <is_input_iterator::value,
497- V,
498- decltype (detail::deref_non_pointer(std::declval<captured_type>()))>
499- push_type;
494+ typedef meta::conditional_t <is_input_iterator::value, V, decltype (detail::deref_non_pointer(std::declval<captured_type>()))> push_type;
500495 typedef std::is_copy_assignable<V> is_copyable;
501- typedef meta::neg<meta::any<
502- std::is_const<V>, std::is_const<std::remove_reference_t <iterator_return>>, meta::neg<is_copyable>>>
503- is_writable;
496+ typedef meta::neg<meta::any<std::is_const<V>, std::is_const<std::remove_reference_t <iterator_return>>, meta::neg<is_copyable>>> is_writable;
504497 typedef meta::unqualified_t <decltype (get_key(is_associative(), std::declval<std::add_lvalue_reference_t <value_type>>()))> key_type;
505498 typedef meta::all<std::is_integral<K>, meta::neg<meta::any<is_associative, is_lookup>>> is_linear_integral;
506499
@@ -509,23 +502,24 @@ namespace sol {
509502 iterator it;
510503 std::size_t i;
511504
512- iter (T& source, iterator it)
513- : source(source), it(std::move(it)), i(0 ) {
505+ iter (T& source, iterator it) : source(source), it(std::move(it)), i(0 ) {
514506 }
515507
516508 ~iter () {
517-
518509 }
519510 };
520511
521512 static auto & get_src (lua_State* L) {
522513#if defined(SOL_SAFE_USERTYPE) && SOL_SAFE_USERTYPE
523514 auto p = stack::unqualified_check_get<T*>(L, 1 );
524515 if (!p) {
525- luaL_error (L, " sol: 'self' is not of type '%s' (pass 'self' as first argument with ':' or call on proper type)" , detail::demangle<T>().c_str ());
516+ luaL_error (L,
517+ " sol: 'self' is not of type '%s' (pass 'self' as first argument with ':' or call on proper type)" ,
518+ detail::demangle<T>().c_str ());
526519 }
527520 if (p.value () == nullptr ) {
528- luaL_error (L, " sol: 'self' argument is nil (pass 'self' as first argument with ':' or call on a '%s' type)" , detail::demangle<T>().c_str ());
521+ luaL_error (
522+ L, " sol: 'self' argument is nil (pass 'self' as first argument with ':' or call on a '%s' type)" , detail::demangle<T>().c_str ());
529523 }
530524 return *p.value ();
531525#else
@@ -613,9 +607,7 @@ namespace sol {
613607 }
614608
615609 static detail::error_result get_comparative (std::true_type, lua_State* L, T& self, K& key) {
616- auto fx = [&](const value_type& r) -> bool {
617- return key == get_key (is_associative (), r);
618- };
610+ auto fx = [&](const value_type& r) -> bool { return key == get_key (is_associative (), r); };
619611 auto e = deferred_uc::end (L, self);
620612 auto it = std::find_if (deferred_uc::begin (L, self), e, std::ref (fx));
621613 if (it == e) {
@@ -625,7 +617,9 @@ namespace sol {
625617 }
626618
627619 static detail::error_result get_comparative (std::false_type, lua_State*, T&, K&) {
628- return detail::error_result (" cannot get this key on '%s': no suitable way to increment iterator and compare to key value '%s'" , detail::demangle<T>().data (), detail::demangle<K>().data ());
620+ return detail::error_result (" cannot get this key on '%s': no suitable way to increment iterator and compare to key value '%s'" ,
621+ detail::demangle<T>().data (),
622+ detail::demangle<K>().data ());
629623 }
630624
631625 static detail::error_result get_it (std::false_type, lua_State* L, T& self, K& key) {
@@ -649,7 +643,8 @@ namespace sol {
649643 }
650644
651645 static detail::error_result set_writable (std::false_type, lua_State*, T&, iterator&, stack_object) {
652- return detail::error_result (" cannot perform a 'set': '%s's iterator reference is not writable (non-copy-assignable or const)" , detail::demangle<T>().data ());
646+ return detail::error_result (
647+ " cannot perform a 'set': '%s's iterator reference is not writable (non-copy-assignable or const)" , detail::demangle<T>().data ());
653648 }
654649
655650 static detail::error_result set_category (std::input_iterator_tag, lua_State* L, T& self, stack_object okey, stack_object value) {
@@ -690,11 +685,10 @@ namespace sol {
690685 static detail::error_result set_comparative (std::true_type, lua_State* L, T& self, stack_object okey, stack_object value) {
691686 decltype (auto ) key = okey.as <K>();
692687 if (!is_writable::value) {
693- return detail::error_result (" cannot perform a 'set': '%s's iterator reference is not writable (non-copy-assignable or const)" , detail::demangle<T>().data ());
688+ return detail::error_result (
689+ " cannot perform a 'set': '%s's iterator reference is not writable (non-copy-assignable or const)" , detail::demangle<T>().data ());
694690 }
695- auto fx = [&](const value_type& r) -> bool {
696- return key == get_key (is_associative (), r);
697- };
691+ auto fx = [&](const value_type& r) -> bool { return key == get_key (is_associative (), r); };
698692 auto e = deferred_uc::end (L, self);
699693 auto it = std::find_if (deferred_uc::begin (L, self), e, std::ref (fx));
700694 if (it == e) {
@@ -704,34 +698,38 @@ namespace sol {
704698 }
705699
706700 static detail::error_result set_comparative (std::false_type, lua_State*, T&, stack_object, stack_object) {
707- return detail::error_result (" cannot set this value on '%s': no suitable way to increment iterator or compare to '%s' key" , detail::demangle<T>().data (), detail::demangle<K>().data ());
701+ return detail::error_result (" cannot set this value on '%s': no suitable way to increment iterator or compare to '%s' key" ,
702+ detail::demangle<T>().data (),
703+ detail::demangle<K>().data ());
708704 }
709705
710706 template <typename Iter>
711707 static detail::error_result set_associative_insert (std::true_type, lua_State*, T& self, Iter& it, K& key, stack_object value) {
712- if constexpr (meta::has_insert<T>::value) {
708+ if constexpr (meta::has_insert<T>::value) {
713709 self.insert (it, value_type (key, value.as <V>()));
714710 return {};
715711 }
716712 else {
717713 (void )self;
718714 (void )it;
719715 (void )key;
720- return detail::error_result (" cannot call 'set' on '%s': there is no 'insert' function on this associative type" , detail::demangle<T>().c_str ());
716+ return detail::error_result (
717+ " cannot call 'set' on '%s': there is no 'insert' function on this associative type" , detail::demangle<T>().c_str ());
721718 }
722719 }
723720
724721 template <typename Iter>
725722 static detail::error_result set_associative_insert (std::false_type, lua_State*, T& self, Iter& it, K& key, stack_object) {
726- if constexpr ( has_insert<T>::value) {
723+ if constexpr (meta:: has_insert<T>::value) {
727724 self.insert (it, key);
728725 return {};
729726 }
730727 else {
731728 (void )self;
732729 (void )it;
733730 (void )key;
734- return detail::error_result (" cannot call 'set' on '%s': there is no 'insert' function on this non-associative type" , detail::demangle<T>().c_str ());
731+ return detail::error_result (
732+ " cannot call 'set' on '%s': there is no 'insert' function on this non-associative type" , detail::demangle<T>().c_str ());
735733 }
736734 }
737735
@@ -822,7 +820,8 @@ namespace sol {
822820
823821 template <bool = false >
824822 static detail::error_result find_comparative (std::false_type, lua_State*, T&) {
825- return detail::error_result (" cannot call 'find' on '%s': there is no 'find' function and the value_type is not equality comparable" , detail::demangle<T>().c_str ());
823+ return detail::error_result (" cannot call 'find' on '%s': there is no 'find' function and the value_type is not equality comparable" ,
824+ detail::demangle<T>().c_str ());
826825 }
827826
828827 template <bool idx_of = false >
@@ -914,7 +913,7 @@ namespace sol {
914913
915914 template <typename Iter>
916915 static detail::error_result add_associative (std::true_type, lua_State* L, T& self, stack_object key, Iter& pos) {
917- if constexpr (meta::has_insert<T>::value) {
916+ if constexpr (meta::has_insert<T>::value) {
918917 self.insert (pos, value_type (key.as <K>(), stack::unqualified_get<V>(L, 3 )));
919918 return {};
920919 }
@@ -923,7 +922,8 @@ namespace sol {
923922 (void )self;
924923 (void )key;
925924 (void )pos;
926- return detail::error_result (" cannot call 'insert' on '%s': there is no 'insert' function on this associative type" , detail::demangle<T>().c_str ());
925+ return detail::error_result (
926+ " cannot call 'insert' on '%s': there is no 'insert' function on this associative type" , detail::demangle<T>().c_str ());
927927 }
928928 }
929929
@@ -990,7 +990,8 @@ namespace sol {
990990 }
991991
992992 static detail::error_result insert_after_has (std::false_type, lua_State*, T&, stack_object, stack_object) {
993- return detail::error_result (" cannot call 'insert' on '%s': no suitable or similar functionality detected on this container" , detail::demangle<T>().data ());
993+ return detail::error_result (
994+ " cannot call 'insert' on '%s': no suitable or similar functionality detected on this container" , detail::demangle<T>().data ());
994995 }
995996
996997 static detail::error_result insert_has (std::true_type, lua_State* L, T& self, stack_object key, stack_object value) {
@@ -1019,9 +1020,7 @@ namespace sol {
10191020 }
10201021
10211022 static detail::error_result erase_integral (std::false_type, lua_State* L, T& self, const K& key) {
1022- auto fx = [&](const value_type& r) -> bool {
1023- return key == r;
1024- };
1023+ auto fx = [&](const value_type& r) -> bool { return key == r; };
10251024 auto e = deferred_uc::end (L, self);
10261025 auto it = std::find_if (deferred_uc::begin (L, self), e, std::ref (fx));
10271026 if (it == e) {
@@ -1106,7 +1105,7 @@ namespace sol {
11061105 }
11071106
11081107 static detail::error_result get_start (lua_State* L, T& self, K& key) {
1109- return get_associative_find (std::integral_constant< bool , is_associative::value && has_find<T>::value> (), L, self, key);
1108+ return get_associative_find (std::integral_constant < bool , is_associative::value&& has_find<T>::value > (), L, self, key);
11101109 }
11111110
11121111 static detail::error_result set_start (lua_State* L, T& self, stack_object key, stack_object value) {
@@ -1333,19 +1332,21 @@ namespace sol {
13331332 T& source;
13341333 iterator it;
13351334
1336- iter (T& source, iterator it)
1337- : source(source), it(std::move(it)) {
1335+ iter (T& source, iterator it) : source(source), it(std::move(it)) {
13381336 }
13391337 };
13401338
13411339 static auto & get_src (lua_State* L) {
13421340 auto p = stack::unqualified_check_get<T*>(L, 1 );
13431341#if defined(SOL_SAFE_USERTYPE) && SOL_SAFE_USERTYPE
13441342 if (!p) {
1345- luaL_error (L, " sol: 'self' is not of type '%s' (pass 'self' as first argument with ':' or call on proper type)" , detail::demangle<T>().c_str ());
1343+ luaL_error (L,
1344+ " sol: 'self' is not of type '%s' (pass 'self' as first argument with ':' or call on proper type)" ,
1345+ detail::demangle<T>().c_str ());
13461346 }
13471347 if (p.value () == nullptr ) {
1348- luaL_error (L, " sol: 'self' argument is nil (pass 'self' as first argument with ':' or call on a '%s' type)" , detail::demangle<T>().c_str ());
1348+ luaL_error (
1349+ L, " sol: 'self' argument is nil (pass 'self' as first argument with ':' or call on a '%s' type)" , detail::demangle<T>().c_str ());
13491350 }
13501351#endif // Safe getting with error
13511352 return *p.value ();
0 commit comments