diff options
author | Murray Cumming <murrayc@murrayc.com> | 2016-03-04 10:26:45 +0100 |
---|---|---|
committer | Murray Cumming <murrayc@murrayc.com> | 2016-03-04 10:33:08 +0100 |
commit | 20ce03f37bb415c21adf090a0898ee1de87f0ba0 (patch) | |
tree | e67b9ae54fc9007369f2bab0eb13e31ea021c145 | |
parent | 9701a24e1091b8949ca7a6b70494bc7d3bf874a3 (diff) | |
download | sigc++-20ce03f37bb415c21adf090a0898ee1de87f0ba0.tar.gz |
C++11: Change all typedefs to using.
29 files changed, 204 insertions, 204 deletions
diff --git a/examples/member_method.cc b/examples/member_method.cc index 574b1fc..5794a9e 100644 --- a/examples/member_method.cc +++ b/examples/member_method.cc @@ -18,7 +18,7 @@ protected: virtual void on_print(int a); - typedef sigc::signal<void, int> type_signal_print; + using type_signal_print = sigc::signal<void, int>; type_signal_print signal_print; }; diff --git a/sigc++/adaptors/adaptor_trait.h b/sigc++/adaptors/adaptor_trait.h index 1b5d70b..2c1640d 100644 --- a/sigc++/adaptors/adaptor_trait.h +++ b/sigc++/adaptors/adaptor_trait.h @@ -68,7 +68,7 @@ template <class T_functor> struct adapts; template <class T_functor> struct adaptor_functor : public adaptor_base { - typedef typename functor_trait<T_functor>::result_type result_type; + using result_type = typename functor_trait<T_functor>::result_type; /** Invokes the wrapped functor passing on the arguments. * @return The return value of the functor invocation. @@ -152,9 +152,9 @@ template <class T_functor, bool I_isadaptor = std::is_base_of<adaptor_base, T_fu template <class T_functor> struct adaptor_trait<T_functor, true> { - typedef typename T_functor::result_type result_type; - typedef T_functor functor_type; - typedef T_functor adaptor_type; + using result_type = typename T_functor::result_type; + using functor_type = T_functor; + using adaptor_type = T_functor; }; /** Trait that specifies what is the adaptor version of a functor type. @@ -166,9 +166,9 @@ struct adaptor_trait<T_functor, true> template <class T_functor> struct adaptor_trait<T_functor, false> { - typedef typename functor_trait<T_functor>::result_type result_type; - typedef typename functor_trait<T_functor>::functor_type functor_type; - typedef adaptor_functor<functor_type> adaptor_type; + using result_type = typename functor_trait<T_functor>::result_type; + using functor_type = typename functor_trait<T_functor>::functor_type; + using adaptor_type = adaptor_functor<functor_type>; }; // Doxygen (at least version 1.8.4) removes blank lines in a code block. @@ -176,7 +176,7 @@ struct adaptor_trait<T_functor, false> /** Base type for adaptors. * sigc::adapts wraps adaptors, functors, function pointers and class methods. * It contains a single member functor which is always a sigc::adaptor_base. - * The typedef adaptor_type defines the exact type that is used + * The adaptor_type alias defines the exact type that is used * to store the adaptor, functor, function pointer or class method passed * into the constructor. It differs from @a T_functor unless @a T_functor * inherits from sigc::adaptor_base. @@ -188,7 +188,7 @@ struct adaptor_trait<T_functor, false> * template <class T_functor> * struct my_adaptor : public sigc::adapts<T_functor> * { - * typedef typename sigc::functor_trait<T_functor>::result_type result_type; + * using result_type = typename sigc::functor_trait<T_functor>::result_type; * // * result_type * operator()() const; @@ -237,8 +237,8 @@ struct adaptor_trait<T_functor, false> template <class T_functor> struct adapts : public adaptor_base { - typedef typename adaptor_trait<T_functor>::result_type result_type; - typedef typename adaptor_trait<T_functor>::adaptor_type adaptor_type; + using result_type = typename adaptor_trait<T_functor>::result_type; + using adaptor_type = typename adaptor_trait<T_functor>::adaptor_type; /** Constructs an adaptor that wraps the passed functor. * @param _A_functor Functor to invoke from operator()(). diff --git a/sigc++/adaptors/bind.h b/sigc++/adaptors/bind.h index 3046c04..ba6b2ad 100644 --- a/sigc++/adaptors/bind.h +++ b/sigc++/adaptors/bind.h @@ -109,8 +109,8 @@ struct TransformEachInvoker template <int I_location, class T_functor, class... T_bound> struct bind_functor : public adapts<T_functor> { - typedef typename adapts<T_functor>::adaptor_type adaptor_type; - typedef typename adaptor_type::result_type result_type; + using adaptor_type = typename adapts<T_functor>::adaptor_type; + using result_type = typename adaptor_type::result_type; /** Invokes the wrapped functor passing on the arguments. * bound_ is passed as the next argument. @@ -171,8 +171,8 @@ private: template <class T_functor, class... T_type> struct bind_functor<-1, T_functor, T_type...> : public adapts<T_functor> { - typedef typename adapts<T_functor>::adaptor_type adaptor_type; - typedef typename adaptor_type::result_type result_type; + using adaptor_type = typename adapts<T_functor>::adaptor_type; + using result_type = typename adaptor_type::result_type; /** Invokes the wrapped functor passing on the arguments. * bound_ is passed as the next argument. diff --git a/sigc++/adaptors/bind_return.h b/sigc++/adaptors/bind_return.h index ff9525c..201376a 100644 --- a/sigc++/adaptors/bind_return.h +++ b/sigc++/adaptors/bind_return.h @@ -17,7 +17,7 @@ namespace sigc { template <class T_return, class T_functor> struct bind_return_functor : public adapts<T_functor> { - typedef typename unwrap_reference<T_return>::type result_type; + using result_type = typename unwrap_reference<T_return>::type; /** Invokes the wrapped functor dropping its return value. * @return The fixed return value. diff --git a/sigc++/adaptors/compose.h b/sigc++/adaptors/compose.h index 11b61a9..57fe15e 100644 --- a/sigc++/adaptors/compose.h +++ b/sigc++/adaptors/compose.h @@ -41,10 +41,10 @@ namespace sigc { template <class T_setter, class T_getter> struct compose1_functor : public adapts<T_setter> { - typedef typename adapts<T_setter>::adaptor_type adaptor_type; - typedef T_setter setter_type; - typedef T_getter getter_type; - typedef typename adaptor_type::result_type result_type; + using adaptor_type = typename adapts<T_setter>::adaptor_type; + using setter_type = T_setter; + using getter_type = T_getter; + using result_type = typename adaptor_type::result_type; decltype(auto) operator()() @@ -81,11 +81,11 @@ struct compose1_functor : public adapts<T_setter> template <class T_setter, class T_getter1, class T_getter2> struct compose2_functor : public adapts<T_setter> { - typedef typename adapts<T_setter>::adaptor_type adaptor_type; - typedef T_setter setter_type; - typedef T_getter1 getter1_type; - typedef T_getter2 getter2_type; - typedef typename adaptor_type::result_type result_type; + using adaptor_type = typename adapts<T_setter>::adaptor_type; + using setter_type = T_setter; + using getter1_type = T_getter1; + using getter2_type = T_getter2; + using result_type = typename adaptor_type::result_type; decltype(auto) operator()() diff --git a/sigc++/adaptors/exception_catch.h b/sigc++/adaptors/exception_catch.h index 03b74c4..4080700 100644 --- a/sigc++/adaptors/exception_catch.h +++ b/sigc++/adaptors/exception_catch.h @@ -57,8 +57,8 @@ namespace sigc { template <class T_functor, class T_catcher, class T_return = typename adapts<T_functor>::result_type> struct exception_catch_functor : public adapts<T_functor> { - typedef typename adapts<T_functor>::adaptor_type adaptor_type; - typedef T_return result_type; + using adaptor_type = typename adapts<T_functor>::adaptor_type; + using result_type = T_return; decltype(auto) operator()() @@ -96,8 +96,8 @@ struct exception_catch_functor : public adapts<T_functor> template <class T_functor, class T_catcher> struct exception_catch_functor<T_functor, T_catcher, void> : public adapts<T_functor> { - typedef void result_type; - typedef typename adapts<T_functor>::adaptor_type adaptor_type; + using result_type = void; + using adaptor_type = typename adapts<T_functor>::adaptor_type; template <class... T_arg> decltype(auto) diff --git a/sigc++/adaptors/hide.h b/sigc++/adaptors/hide.h index 2417ff9..e6b186a 100644 --- a/sigc++/adaptors/hide.h +++ b/sigc++/adaptors/hide.h @@ -68,8 +68,8 @@ namespace sigc { template <int I_location, class T_functor> struct hide_functor : public adapts<T_functor> { - typedef typename adapts<T_functor>::adaptor_type adaptor_type; - typedef typename adaptor_type::result_type result_type; + using adaptor_type = typename adapts<T_functor>::adaptor_type; + using result_type = typename adaptor_type::result_type; /** Invokes the wrapped functor, ignoring the argument at index @e I_location (0-indexed). * @param _A_a Arguments to be passed on to the functor, apart from the ignored argument. diff --git a/sigc++/adaptors/macros/retype.h.m4 b/sigc++/adaptors/macros/retype.h.m4 index 2478a3b..5fd608d 100644 --- a/sigc++/adaptors/macros/retype.h.m4 +++ b/sigc++/adaptors/macros/retype.h.m4 @@ -98,8 +98,8 @@ template <class T_functor, class... T_type> struct retype_functor : public adapts<T_functor> { - typedef typename adapts<T_functor>::adaptor_type adaptor_type; - typedef typename adapts<T_functor>::result_type result_type; + using adaptor_type = typename adapts<T_functor>::adaptor_type; + using result_type = typename adapts<T_functor>::result_type; template <class... T_arg> decltype(auto) diff --git a/sigc++/adaptors/retype_return.h b/sigc++/adaptors/retype_return.h index 29b8eb0..0654592 100644 --- a/sigc++/adaptors/retype_return.h +++ b/sigc++/adaptors/retype_return.h @@ -16,7 +16,7 @@ namespace sigc { template <class T_return, class T_functor> struct retype_return_functor : public adapts<T_functor> { - typedef T_return result_type; + using result_type = T_return; T_return operator()(); @@ -53,7 +53,7 @@ T_return retype_return_functor<T_return, T_functor>::operator()() template <class T_functor> struct retype_return_functor<void, T_functor> : public adapts<T_functor> { - typedef void result_type; + using result_type = void; void operator()(); diff --git a/sigc++/adaptors/track_obj.h b/sigc++/adaptors/track_obj.h index 43ae600..118ce4e 100644 --- a/sigc++/adaptors/track_obj.h +++ b/sigc++/adaptors/track_obj.h @@ -50,8 +50,8 @@ template <typename T_functor, typename... T_obj> class track_obj_functor : public adapts<T_functor> { public: - typedef typename adapts<T_functor>::adaptor_type adaptor_type; - typedef typename adaptor_type::result_type result_type; + using adaptor_type = typename adapts<T_functor>::adaptor_type; + using result_type = typename adaptor_type::result_type; /** Constructs a track_obj_functor object that wraps the passed functor and * stores a reference to the passed trackable objects. diff --git a/sigc++/functors/functor_trait.h b/sigc++/functors/functor_trait.h index 904d507..24dfde6 100644 --- a/sigc++/functors/functor_trait.h +++ b/sigc++/functors/functor_trait.h @@ -28,7 +28,7 @@ namespace sigc { * the result type of your functors. There are different ways to achieve that. * * - Derive your functors from sigc::functor_base and place - * <tt>typedef T_return result_type;</tt> in the class definition. + * <tt>using result_type = T_return;</tt> in the class definition. * - Use the macro SIGC_FUNCTOR_TRAIT(T_functor,T_return) in namespace sigc. * Multi-type functors are only partly supported. * - For functors not derived from sigc::functor_base, and not specified with @@ -102,23 +102,23 @@ template <class T_functor, bool I_can_use_decltype = can_deduce_result_type_with_decltype<T_functor>::value> struct functor_trait { - typedef void result_type; - typedef T_functor functor_type; + using result_type = void; + using functor_type = T_functor; }; #ifndef DOXYGEN_SHOULD_SKIP_THIS template <class T_functor, bool I_can_use_decltype> struct functor_trait<T_functor, true, I_can_use_decltype> { - typedef typename T_functor::result_type result_type; - typedef T_functor functor_type; + using result_type = typename T_functor::result_type; + using functor_type = T_functor; }; template <typename T_functor> struct functor_trait<T_functor, false, true> { - typedef typename functor_trait<decltype(&T_functor::operator()), false, false>::result_type result_type; - typedef T_functor functor_type; + using result_type = typename functor_trait<decltype(&T_functor::operator()), false, false>::result_type; + using functor_type = T_functor; }; #endif // DOXYGEN_SHOULD_SKIP_THIS @@ -136,8 +136,8 @@ struct functor_trait<T_functor, false, true> template <class T_functor> \ struct functor_trait<T_functor, false, false> \ { \ - typedef typename T_functor::result_type result_type; \ - typedef T_functor functor_type; \ + using result_type = typename T_functor::result_type; \ + using functor_type = T_functor; \ }; /** Helper macro, if you want to mix user-defined and third party functors with libsigc++. @@ -159,14 +159,14 @@ struct functor_trait<T_functor, false, false> \ template <> \ struct functor_trait<T_functor, false, false> \ { \ - typedef T_return result_type; \ - typedef T_functor functor_type; \ + using result_type = T_return; \ + using functor_type = T_functor; \ }; \ template <> \ struct functor_trait<T_functor, false, true> \ { \ - typedef T_return result_type; \ - typedef T_functor functor_type; \ + using result_type = T_return; \ + using functor_type = T_functor; \ }; #ifndef SIGCXX_DISABLE_DEPRECATED @@ -205,8 +205,8 @@ class pointer_functor; template <class T_return, class... T_arg> struct functor_trait<T_return (*)(T_arg...), false, false> { - typedef T_return result_type; - typedef pointer_functor<T_return, T_arg...> functor_type; + using result_type = T_return; + using functor_type = pointer_functor<T_return, T_arg...>; }; @@ -218,15 +218,15 @@ template <class T_return, class T_obj, class... T_arg> class const_mem_functor; template <class T_return, class T_obj, class... T_arg> struct functor_trait<T_return (T_obj::*)(T_arg...), false, false> { - typedef T_return result_type; - typedef mem_functor<T_return, T_obj, T_arg...> functor_type; + using result_type = T_return; + using functor_type = mem_functor<T_return, T_obj, T_arg...>; }; template <class T_return, class T_obj, class... T_arg> struct functor_trait<T_return (T_obj::*)(T_arg...) const, false, false> { - typedef T_return result_type; - typedef const_mem_functor<T_return, T_obj, T_arg...> functor_type; + using result_type = T_return; + using functor_type = const_mem_functor<T_return, T_obj, T_arg...>; }; #endif // DOXYGEN_SHOULD_SKIP_THIS diff --git a/sigc++/functors/macros/mem_fun.h.m4 b/sigc++/functors/macros/mem_fun.h.m4 index 3fce69e..5669688 100644 --- a/sigc++/functors/macros/mem_fun.h.m4 +++ b/sigc++/functors/macros/mem_fun.h.m4 @@ -33,8 +33,8 @@ template <class T_return, class T_obj, class... T_arg> class [$1]mem_functor : public functor_base { public: - typedef T_return (T_obj::*function_type)(T_arg...) $3; - typedef T_return result_type; + using function_type = T_return (T_obj::*)(T_arg...) $3; + using result_type = T_return; /// Constructs an invalid functor. [$1]mem_functor() : func_ptr_(nullptr) {} @@ -83,9 +83,9 @@ template <class T_return, class T_obj, class... T_arg> class bound_[$1]mem_functor : public [$1]mem_functor<T_return, T_obj, T_arg...> { - typedef [$1]mem_functor<T_return, T_obj, T_arg...> base_type_; + using base_type_ = [$1]mem_functor<T_return, T_obj, T_arg...>; public: - typedef typename base_type_::function_type function_type; + using function_type = typename base_type_::function_type; /** Constructs a bound_[$1]mem_functor object that wraps the passed method. * @param _A_obj Pointer to instance the method will operate on. diff --git a/sigc++/functors/slot.h b/sigc++/functors/slot.h index 47a8972..ad23ab1 100644 --- a/sigc++/functors/slot.h +++ b/sigc++/functors/slot.h @@ -21,12 +21,12 @@ template <class T_functor> struct typed_slot_rep : public slot_rep { private: - typedef typed_slot_rep<T_functor> self; + using self = typed_slot_rep<T_functor>; public: /* Use an adaptor type so that arguments can be passed as const references * through explicit template instantiation from slot_call#::call_it() */ - typedef typename adaptor_trait<T_functor>::adaptor_type adaptor_type; + using adaptor_type = typename adaptor_trait<T_functor>::adaptor_type; /** The functor contained by this slot_rep object. */ adaptor_type functor_; @@ -105,7 +105,7 @@ struct slot_call */ static T_return call_it(slot_rep* rep, type_trait_take_t<T_arg>... a_) { - typedef typed_slot_rep<T_functor> typed_slot; + using typed_slot = typed_slot_rep<T_functor>; typed_slot *typed_rep = static_cast<typed_slot*>(rep); return (typed_rep->functor_).template operator()<type_trait_take_t<T_arg>...> (a_...); @@ -151,14 +151,14 @@ class slot : public slot_base { public: - typedef T_return result_type; + using result_type = T_return; //TODO: using arg_type_ = type_trait_take_t<T_arg>; #ifndef DOXYGEN_SHOULD_SKIP_THIS private: - typedef internal::slot_rep rep_type; + using rep_type = internal::slot_rep; public: - typedef T_return (*call_type)(rep_type*, type_trait_take_t<T_arg>...); + using call_type = T_return (*)(rep_type*, type_trait_take_t<T_arg>...); #endif /** Invoke the contained functor unless slot is in blocking state. diff --git a/sigc++/functors/slot_base.h b/sigc++/functors/slot_base.h index 7111a2e..5516aa2 100644 --- a/sigc++/functors/slot_base.h +++ b/sigc++/functors/slot_base.h @@ -28,7 +28,7 @@ namespace sigc namespace internal { -typedef void* (*hook)(void*); +using hook = void* (*)(void*); /** Internal representation of a slot. * Derivations of this class can be considered as a link @@ -78,7 +78,7 @@ struct SIGC_API slot_rep : public trackable */ func_destroy_notify destroy_; - typedef slot_rep* (*hook_dup)(slot_rep*); + using hook_dup = slot_rep* (*)(slot_rep*); private: /** Callback that makes a deep copy of the slot_rep object. @@ -247,7 +247,7 @@ struct SIGC_API slot_do_unbind */ class SIGC_API slot_base : public functor_base { - typedef internal::slot_rep rep_type; + using rep_type = internal::slot_rep; // Move operations are not declared noexcept because // 1. they may copy instead of move @@ -284,7 +284,7 @@ public: */ explicit operator bool() const noexcept; - typedef notifiable::func_destroy_notify func_destroy_notify; + using func_destroy_notify = notifiable::func_destroy_notify; /** Sets the parent of this slot. * This function is used by signals to register a notification callback. diff --git a/sigc++/reference_wrapper.h b/sigc++/reference_wrapper.h index 99b072f..7dc0790 100644 --- a/sigc++/reference_wrapper.h +++ b/sigc++/reference_wrapper.h @@ -24,19 +24,19 @@ namespace sigc { template <class T_type> struct unwrap_reference { - typedef T_type type; + using type = T_type; }; template <class T_type> struct unwrap_reference<std::reference_wrapper<T_type> > { - typedef T_type& type; + using type = T_type&; }; template <class T_type> struct unwrap_reference<std::reference_wrapper<const T_type> > { - typedef const T_type& type; + using type = const T_type&; }; template <class T_type> diff --git a/sigc++/signal.h b/sigc++/signal.h index 0938720..f19242f 100644 --- a/sigc++/signal.h +++ b/sigc++/signal.h @@ -38,17 +38,17 @@ namespace sigc { template <typename T_slot> struct slot_iterator { - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; - typedef std::bidirectional_iterator_tag iterator_category; + using size_type = std::size_t; + using difference_type = std::ptrdiff_t; + using iterator_category = std::bidirectional_iterator_tag; - typedef T_slot slot_type; + using slot_type = T_slot; - typedef T_slot value_type; - typedef T_slot* pointer; - typedef T_slot& reference; + using value_type = T_slot; + using pointer = T_slot*; + using reference = T_slot&; - typedef typename internal::signal_impl::iterator_type iterator_type; + using iterator_type = typename internal::signal_impl::iterator_type; slot_iterator() {} @@ -104,17 +104,17 @@ struct slot_iterator template <typename T_slot> struct slot_const_iterator { - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; - typedef std::bidirectional_iterator_tag iterator_category; + using size_type = std::size_t; + using difference_type = std::ptrdiff_t; + using iterator_category = std::bidirectional_iterator_tag; - typedef T_slot slot_type; + using slot_type = T_slot; - typedef T_slot value_type; - typedef const T_slot* pointer; - typedef const T_slot& reference; + using value_type = T_slot; + using pointer = const T_slot*; + using reference = const T_slot&; - typedef typename internal::signal_impl::const_iterator_type iterator_type; + using iterator_type = typename internal::signal_impl::const_iterator_type; slot_const_iterator() {} @@ -174,16 +174,16 @@ struct slot_const_iterator template <class T_slot> struct slot_list { - typedef T_slot slot_type; + using slot_type = T_slot; - typedef slot_type& reference; - typedef const slot_type& const_reference; + using reference = slot_type&; + using const_reference = const slot_type&; - typedef slot_iterator<slot_type> iterator; - typedef slot_const_iterator<slot_type> const_iterator; + using iterator = slot_iterator<slot_type>; + using const_iterator = slot_const_iterator<slot_type>; - typedef std::reverse_iterator<iterator> reverse_iterator; - typedef std::reverse_iterator<const_iterator> const_reverse_iterator; + using reverse_iterator = std::reverse_iterator<iterator>; + using const_reverse_iterator = std::reverse_iterator<const_iterator>; slot_list() : list_(nullptr) {} @@ -279,21 +279,21 @@ namespace internal { template <class T_emitter, class T_result = typename T_emitter::result_type> struct slot_iterator_buf { - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; - typedef std::bidirectional_iterator_tag iterator_category; + using size_type = std::size_t; + using difference_type = std::ptrdiff_t; + using iterator_category = std::bidirectional_iterator_tag; //These are needed just to make this a proper C++ iterator, //that can be used with standard C++ algorithms. - typedef T_result value_type; - typedef T_result& reference; - typedef T_result* pointer; + using value_type = T_result; + using reference = T_result&; + using pointer = T_result*; - typedef T_emitter emitter_type; - typedef T_result result_type; - typedef typename T_emitter::slot_type slot_type; + using emitter_type = T_emitter; + using result_type = T_result; + using slot_type = typename T_emitter::slot_type; - typedef signal_impl::const_iterator_type iterator_type; + using iterator_type = signal_impl::const_iterator_type; slot_iterator_buf() : c_(nullptr), invoked_(false) {} @@ -362,15 +362,15 @@ private: template <class T_emitter> struct slot_iterator_buf<T_emitter, void> { - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; - typedef std::bidirectional_iterator_tag iterator_category; + using size_type = std::size_t; + using difference_type = std::ptrdiff_t; + using iterator_category = std::bidirectional_iterator_tag; - typedef T_emitter emitter_type; - typedef void result_type; - typedef typename T_emitter::slot_type slot_type; + using emitter_type = T_emitter; + using result_type = void; + using slot_type = typename T_emitter::slot_type; - typedef signal_impl::const_iterator_type iterator_type; + using iterator_type = signal_impl::const_iterator_type; slot_iterator_buf() : c_(nullptr), invoked_(false) {} @@ -433,21 +433,21 @@ private: template <class T_emitter, class T_result = typename T_emitter::result_type> struct slot_reverse_iterator_buf { - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; - typedef std::bidirectional_iterator_tag iterator_category; + using size_type = std::size_t; + using difference_type = std::ptrdiff_t; + using iterator_category = std::bidirectional_iterator_tag; //These are needed just to make this a proper C++ iterator, //that can be used with standard C++ algorithms. - typedef T_result value_type; - typedef T_result& reference; - typedef T_result* pointer; + using value_type = T_result; + using reference = T_result&; + using pointer = T_result*; - typedef T_emitter emitter_type; - typedef T_result result_type; - typedef typename T_emitter::slot_type slot_type; + using emitter_type = T_emitter; + using result_type = T_result; + using slot_type = typename T_emitter::slot_type; - typedef signal_impl::const_iterator_type iterator_type; + using iterator_type = signal_impl::const_iterator_type; slot_reverse_iterator_buf() : c_(nullptr), invoked_(false) {} @@ -518,15 +518,15 @@ private: template <class T_emitter> struct slot_reverse_iterator_buf<T_emitter, void> { - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; - typedef std::bidirectional_iterator_tag iterator_category; + using size_type = std::size_t; + using difference_type = std::ptrdiff_t; + using iterator_category = std::bidirectional_iterator_tag; - typedef T_emitter emitter_type; - typedef void result_type; - typedef typename T_emitter::slot_type slot_type; + using emitter_type = T_emitter; + using result_type = void; + using slot_type = typename T_emitter::slot_type; - typedef signal_impl::const_iterator_type iterator_type; + using iterator_type = signal_impl::const_iterator_type; slot_reverse_iterator_buf() : c_(nullptr), invoked_(false) {} @@ -597,12 +597,12 @@ private: template <class T_return, class T_accumulator, class... T_arg> struct signal_emit { - typedef signal_emit<T_return, T_accumulator, T_arg...> self_type; - typedef typename T_accumulator::result_type result_type; - typedef slot<T_return, T_arg...> slot_type; - typedef internal::slot_iterator_buf<self_type, T_return> slot_iterator_buf_type; - typedef internal::slot_reverse_iterator_buf<self_type, T_return> slot_reverse_iterator_buf_type; - typedef signal_impl::const_iterator_type iterator_type; + using self_type = signal_emit<T_return, T_accumulator, T_arg...>; + using result_type = typename T_accumulator::result_type; + using slot_type = slot<T_return, T_arg...>; + using slot_iterator_buf_type = internal::slot_iterator_buf<self_type, T_return>; + using slot_reverse_iterator_buf_type = internal::slot_reverse_iterator_buf<self_type, T_return>; + using iterator_type = signal_impl::const_iterator_type; /** Instantiates the class. * The parameters are stored in member variables. operator()() passes @@ -681,11 +681,11 @@ private: template <class T_return, class... T_arg> struct signal_emit<T_return, void, T_arg...> { - typedef signal_emit<T_return, void, T_arg...> self_type; - typedef T_return result_type; - typedef slot<T_return, T_arg...> slot_type; - typedef signal_impl::const_iterator_type iterator_type; - typedef typename slot_type::call_type call_type; + using self_type = signal_emit<T_return, void, T_arg...>; + using result_type = T_return; + using slot_type = slot<T_return, T_arg...>; + using iterator_type = signal_impl::const_iterator_type; + using call_type = typename slot_type::call_type; /** Executes a list of slots. * The arguments are passed directly on to the slots. @@ -741,7 +741,7 @@ struct signal_emit<T_return, void, T_arg...> //Use this scope to make sure that "slots" is destroyed before "exec" is destroyed. //This avoids a leak on MSVC++ - see http://bugzilla.gnome.org/show_bug.cgi?id=306249 { - typedef std::reverse_iterator<signal_impl::iterator_type> reverse_iterator_type; + using reverse_iterator_type = std::reverse_iterator<signal_impl::iterator_type>; temp_slot_list slots(impl->slots_); reverse_iterator_type it(slots.end()); @@ -772,11 +772,11 @@ struct signal_emit<T_return, void, T_arg...> template <class... T_arg> struct signal_emit<void, void, T_arg...> { - typedef signal_emit<void, void, T_arg...> self_type; - typedef void result_type; - typedef slot<void, T_arg...> slot_type; - typedef signal_impl::const_iterator_type iterator_type; - typedef typename slot_type::call_type call_type; + using self_type = signal_emit<void, void, T_arg...>; + using result_type = void; + using slot_type = slot<void, T_arg...>; + using iterator_type = signal_impl::const_iterator_type; + using call_type = typename slot_type::call_type; /** Executes a list of slots using an accumulator of type @e T_accumulator. * The arguments are passed directly on to the slots. * @param _A_a Arguments to be passed on to the slots. @@ -805,7 +805,7 @@ struct signal_emit<void, void, T_arg...> signal_exec exec(impl); temp_slot_list slots(impl->slots_); - typedef std::reverse_iterator<signal_impl::iterator_type> reverse_iterator_type; + using reverse_iterator_type = std::reverse_iterator<signal_impl::iterator_type>; for (reverse_iterator_type it = reverse_iterator_type(slots.end()); it != reverse_iterator_type(slots.begin()); ++it) { @@ -852,14 +852,14 @@ class signal_with_accumulator : public signal_base { public: - typedef internal::signal_emit<T_return, T_accumulator, T_arg...> emitter_type; - typedef typename emitter_type::result_type result_type; - typedef slot<T_return, T_arg...> slot_type; - typedef slot_list<slot_type> slot_list_type; - typedef typename slot_list_type::iterator iterator; - typedef typename slot_list_type::const_iterator const_iterator; - typedef typename slot_list_type::reverse_iterator reverse_iterator; - typedef typename slot_list_type::const_reverse_iterator const_reverse_iterator; + using emitter_type = internal::signal_emit<T_return, T_accumulator, T_arg...>; + using result_type = typename emitter_type::result_type; + using slot_type = slot<T_return, T_arg...>; + using slot_list_type = slot_list<slot_type>; + using iterator = typename slot_list_type::iterator; + using const_iterator = typename slot_list_type::const_iterator; + using reverse_iterator = typename slot_list_type::reverse_iterator; + using const_reverse_iterator = typename slot_list_type::const_reverse_iterator; /** Add a slot to the list of slots. * Any functor or slot may be passed into connect(). @@ -1017,7 +1017,7 @@ public: * @code * struct arithmetic_mean_accumulator * { - * typedef double result_type; + * using result_type = double; * template<typename T_iterator> * result_type operator()(T_iterator first, T_iterator last) const * { @@ -1035,7 +1035,7 @@ public: * @code * struct interruptable_accumulator * { - * typedef bool result_type; + * using result_type = bool; * template<typename T_iterator> * result_type operator()(T_iterator first, T_iterator last) const * { diff --git a/sigc++/signal_base.h b/sigc++/signal_base.h index d19a341..a0e2037 100644 --- a/sigc++/signal_base.h +++ b/sigc++/signal_base.h @@ -44,10 +44,10 @@ namespace internal */ struct SIGC_API signal_impl : public notifiable { - typedef std::size_t size_type; - typedef std::list<slot_base> slot_list; - typedef slot_list::iterator iterator_type; - typedef slot_list::const_iterator const_iterator_type; + using size_type = std::size_t; + using slot_list = std::list<slot_base>; + using iterator_type = slot_list::iterator; + using const_iterator_type = slot_list::const_iterator; signal_impl(); ~signal_impl(); @@ -215,9 +215,9 @@ struct SIGC_API signal_exec */ struct temp_slot_list { - typedef signal_impl::slot_list slot_list; - typedef signal_impl::iterator_type iterator; - typedef signal_impl::const_iterator_type const_iterator; + using slot_list = signal_impl::slot_list; + using iterator = signal_impl::iterator_type; + using const_iterator = signal_impl::const_iterator_type; temp_slot_list(slot_list &slots) : slots_(slots) { @@ -265,7 +265,7 @@ private: * class MyClass * { * public: - * typedef sigc::signal<void> MySignalType; + * using MySignalType = sigc::signal<void>; * MySignalType get_my_signal() { return m_my_signal; } * private: * MySignalType m_my_signal; @@ -302,7 +302,7 @@ private: */ struct SIGC_API signal_base : public trackable { - typedef std::size_t size_type; + using size_type = std::size_t; signal_base() noexcept; @@ -357,7 +357,7 @@ struct SIGC_API signal_base : public trackable void unblock() noexcept; protected: - typedef internal::signal_impl::iterator_type iterator_type; + using iterator_type = internal::signal_impl::iterator_type; /** Adds a slot at the end of the list of slots. * With connect(), slots can also be added during signal emission. diff --git a/sigc++/trackable.h b/sigc++/trackable.h index f148785..26ee492 100644 --- a/sigc++/trackable.h +++ b/sigc++/trackable.h @@ -27,7 +27,7 @@ struct notifiable; namespace internal { -typedef void (*func_destroy_notify) (notifiable* data); +using func_destroy_notify = void (*) (notifiable* data); /** Destroy notification callback. @@ -81,7 +81,7 @@ struct SIGC_API trackable_callback_list ~trackable_callback_list(); private: - typedef std::list<trackable_callback> callback_list; + using callback_list = std::list<trackable_callback>; callback_list callbacks_; bool clearing_; }; @@ -91,7 +91,7 @@ private: struct SIGC_API notifiable { - typedef internal::func_destroy_notify func_destroy_notify; + using func_destroy_notify = internal::func_destroy_notify; }; @@ -138,7 +138,7 @@ struct SIGC_API trackable : public notifiable who insist on using "trackable*" as pointer type for their own derived objects */ - typedef internal::func_destroy_notify func_destroy_notify; + using func_destroy_notify = internal::func_destroy_notify; /** Add a callback that is executed (notified) when the trackable object is detroyed. * @param data Passed into func upon notification. diff --git a/sigc++/type_traits.h b/sigc++/type_traits.h index 41b2a41..fe67e3c 100644 --- a/sigc++/type_traits.h +++ b/sigc++/type_traits.h @@ -27,36 +27,36 @@ namespace sigc { template <class T_type> struct type_trait { - typedef T_type& pass; - typedef const T_type& take; + using pass = T_type&; + using take = const T_type&; }; template <class T_type, int N> struct type_trait<T_type[N]> { - typedef T_type*& pass; - typedef const T_type*& take; + using pass = T_type*&; + using take = const T_type*&; }; template <class T_type> struct type_trait<T_type&> { - typedef T_type& pass; - typedef T_type& take; + using pass = T_type&; + using take = T_type&; }; template <class T_type> struct type_trait<const T_type&> { - typedef const T_type& pass; - typedef const T_type& take; + using pass = const T_type&; + using take = const T_type&; }; template<> struct type_trait<void> { - typedef void pass; - typedef void take; + using pass = void; + using take = void; }; template<typename T> diff --git a/sigc++/visit_each.h b/sigc++/visit_each.h index ab681cb..487477a 100644 --- a/sigc++/visit_each.h +++ b/sigc++/visit_each.h @@ -52,7 +52,7 @@ struct with_type<true, T_type, T_limit> template <class T_target, class T_action> struct limit_derived_target { - typedef limit_derived_target<T_target, T_action> T_self; + using T_self = limit_derived_target<T_target, T_action>; template <class T_type> void operator()(const T_type& _A_type) const @@ -90,7 +90,7 @@ struct with_type_pointer<true, T_type, T_limit> template <class T_target, class T_action> struct limit_derived_target<T_target*, T_action> { - typedef limit_derived_target<T_target*, T_action> T_self; + using T_self = limit_derived_target<T_target*, T_action>; template <class T_type> void operator()(const T_type& _A_type) const @@ -177,7 +177,7 @@ void visit_each(const T_action& _A_action, const T_functor& _A_functor) template <class T_type, class T_action, class T_functor> void visit_each_type(const T_action& _A_action, const T_functor& _A_functor) { - typedef internal::limit_derived_target<T_type, T_action> type_limited_action; + using type_limited_action = internal::limit_derived_target<T_type, T_action>; type_limited_action limited_action(_A_action); diff --git a/tests/test_accum_iter.cc b/tests/test_accum_iter.cc index 640d39a..909a466 100644 --- a/tests/test_accum_iter.cc +++ b/tests/test_accum_iter.cc @@ -17,7 +17,7 @@ int ident(int i) template<typename T> struct min_accum { - typedef T result_type; + using result_type = T; template<class I> typename std::iterator_traits<I>::value_type operator()(I i1, I i2) diff --git a/tests/test_accumulated.cc b/tests/test_accumulated.cc index 436ace4..1efa979 100644 --- a/tests/test_accumulated.cc +++ b/tests/test_accumulated.cc @@ -19,7 +19,7 @@ std::ostringstream result_stream; struct arithmetic_mean_accumulator { - typedef double result_type; + using result_type = double; template<typename T_iterator> double operator()(T_iterator first, T_iterator last) const { @@ -34,7 +34,7 @@ struct arithmetic_mean_accumulator template<class Ret> struct vector_accumulator { - typedef std::vector<Ret> result_type; + using result_type = std::vector<Ret>; template<typename T_iterator> result_type operator()(T_iterator first, T_iterator last) const { diff --git a/tests/test_bind.cc b/tests/test_bind.cc index 3ab7cf6..b0f356e 100644 --- a/tests/test_bind.cc +++ b/tests/test_bind.cc @@ -18,7 +18,7 @@ std::ostringstream result_stream; struct foo : public sigc::functor_base { // choose a type that can hold all return values - typedef int result_type; + using result_type = int; int operator()(int i) { @@ -41,7 +41,7 @@ struct foo : public sigc::functor_base struct foo_void : public sigc::functor_base { - typedef void result_type; + using result_type = void; void operator()(int i) { diff --git a/tests/test_compose.cc b/tests/test_compose.cc index a626ba6..1169be6 100644 --- a/tests/test_compose.cc +++ b/tests/test_compose.cc @@ -18,7 +18,7 @@ std::ostringstream result_stream; struct set { // choose a type that can hold all return values - typedef double result_type; + using result_type = double; double operator()(int i) { @@ -35,7 +35,7 @@ struct set struct set_void { - typedef void result_type; + using result_type = void; void operator()(double i) { @@ -65,7 +65,7 @@ struct get } #else // choose a type that can hold all return values - typedef double result_type; + using result_type = double; double operator()() { diff --git a/tests/test_exception_catch.cc b/tests/test_exception_catch.cc index 6ae7e51..a2838df 100644 --- a/tests/test_exception_catch.cc +++ b/tests/test_exception_catch.cc @@ -15,7 +15,7 @@ std::ostringstream result_stream; struct f : public sigc::functor_base { - typedef int result_type; + using result_type = int; int operator()(int i) { @@ -26,7 +26,7 @@ struct f : public sigc::functor_base struct g : public sigc::functor_base { - typedef int result_type; + using result_type = int; int operator()() { @@ -37,7 +37,7 @@ struct g : public sigc::functor_base struct g_void : public sigc::functor_base { - typedef void result_type; + using result_type = void; void operator()() { diff --git a/tests/test_hide.cc b/tests/test_hide.cc index c1cdad2..32a2a3a 100644 --- a/tests/test_hide.cc +++ b/tests/test_hide.cc @@ -15,7 +15,7 @@ std::ostringstream result_stream; struct foo : public sigc::functor_base { // choose a type that can hold all return values - typedef int result_type; + using result_type = int; int operator()() { @@ -32,7 +32,7 @@ struct foo : public sigc::functor_base struct foo_void : public sigc::functor_base { - typedef void result_type; + using result_type = void; void operator()() { diff --git a/tests/test_retype_return.cc b/tests/test_retype_return.cc index 9026e32..3c83ed2 100644 --- a/tests/test_retype_return.cc +++ b/tests/test_retype_return.cc @@ -15,7 +15,7 @@ std::ostringstream result_stream; struct foo : public sigc::functor_base { - typedef float result_type; + using result_type = float; float operator()(int i) { @@ -32,7 +32,7 @@ struct foo : public sigc::functor_base struct bar : public sigc::trackable, public sigc::functor_base { - typedef int result_type; + using result_type = int; int operator()(int i) { diff --git a/tests/test_track_obj.cc b/tests/test_track_obj.cc index 635be0c..b56c5e2 100644 --- a/tests/test_track_obj.cc +++ b/tests/test_track_obj.cc @@ -62,7 +62,7 @@ struct bar_group4 : public sigc::trackable class Functor1 : public sigc::functor_base { public: - typedef std::string result_type; + using result_type = std::string; Functor1(const bar_group4& bar) : bar_(bar) {} @@ -79,7 +79,7 @@ private: class Functor2 : public sigc::functor_base { public: - typedef std::string result_type; + using result_type = std::string; Functor2(const bar_group4& bar, const book& aBook) : bar_(bar), aBook_(aBook) {} diff --git a/tests/test_visit_each.cc b/tests/test_visit_each.cc index 119ee10..add80a5 100644 --- a/tests/test_visit_each.cc +++ b/tests/test_visit_each.cc @@ -88,7 +88,7 @@ namespace ns1 template <class T_functor> struct MyAdaptor1 : public sigc::adapts<T_functor> { - typedef typename sigc::functor_trait<T_functor>::result_type result_type; + using result_type = typename sigc::functor_trait<T_functor>::result_type; result_type operator()() const |