From: Justin Gibbs Date: Thu, 29 Oct 2015 21:35:22 +0000 (-0700) Subject: Prefer template aliases to classes in IntrusiveList X-Git-Tag: deprecate-dynamic-initializer~286 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=304eb8d23f5e6189609907c1606229aa5f96ee1c;p=folly.git Prefer template aliases to classes in IntrusiveList Summary: Convert helper classes to using statements now that GCC has caught up with c++11. Reviewed By: simpkins Differential Revision: D2561364 fb-gh-sync-id: 712591549aba9450d159468dc3b26a987ffe9b82 --- diff --git a/folly/IntrusiveList.h b/folly/IntrusiveList.h index bb1979bf..5e47c347 100644 --- a/folly/IntrusiveList.h +++ b/folly/IntrusiveList.h @@ -18,7 +18,7 @@ #define FOLLY_INTRUSIVELIST_H_ /* - * This file contains convenience typedefs that make boost::intrusive::list + * This file contains convenience aliases that make boost::intrusive::list * easier to use. */ @@ -29,9 +29,8 @@ namespace folly { /** * An auto-unlink intrusive list hook. */ -typedef boost::intrusive::list_member_hook< - boost::intrusive::link_mode > - IntrusiveListHook; +using IntrusiveListHook = boost::intrusive::list_member_hook< + boost::intrusive::link_mode>; /** * An intrusive list. @@ -50,7 +49,7 @@ typedef boost::intrusive::list_member_hook< * IntrusiveListHook listHook; * }; * - * typedef IntrusiveList FooList; + * using FooList = IntrusiveList; * * Foo *foo = new Foo(); * FooList myList; @@ -62,25 +61,18 @@ typedef boost::intrusive::list_member_hook< * * The elements stored in the list must contain an IntrusiveListHook member * variable. - * - * TODO: This should really be a template alias. However, gcc doesn't support - * template aliases yet. A subclass is a reasonable workaround for now. This - * subclass only supports the default constructor, but we could add other - * constructors if necessary. */ template -class IntrusiveList : public boost::intrusive::list< +using IntrusiveList = boost::intrusive::list< T, boost::intrusive::member_hook, - boost::intrusive::constant_time_size > { -}; + boost::intrusive::constant_time_size>; /** * A safe-link intrusive list hook. */ -typedef boost::intrusive::list_member_hook< - boost::intrusive::link_mode > - SafeIntrusiveListHook; +using SafeIntrusiveListHook = boost::intrusive::list_member_hook< + boost::intrusive::link_mode>; /** * An intrusive list with const-time size() method. @@ -104,7 +96,7 @@ typedef boost::intrusive::list_member_hook< * SafeIntrusiveListHook listHook; * }; * - * typedef CountedIntrusiveList FooList; + * using FooList = CountedIntrusiveList FooList; * * Foo *foo = new Foo(); * FooList myList; @@ -117,18 +109,12 @@ typedef boost::intrusive::list_member_hook< * * The elements stored in the list must contain an SafeIntrusiveListHook member * variable. - * - * TODO: This should really be a template alias. However, gcc doesn't support - * template aliases yet. A subclass is a reasonable workaround for now. This - * subclass only supports the default constructor, but we could add other - * constructors if necessary. */ template -class CountedIntrusiveList : public boost::intrusive::list< +using CountedIntrusiveList = boost::intrusive::list< T, boost::intrusive::member_hook, - boost::intrusive::constant_time_size > { -}; + boost::intrusive::constant_time_size>; } // folly