templates - Standard way of shortening C++ function signatures -
the templates lengthy when have vector , templated contained objects , end looks bunch of > > > > > > >
hardly helps discern boundaries sometimes, this:
std::vector< std::pair< std::string, std::set< std::string > > >
is there standard way reduce length, or make items distinguishable? actual code class declaration.
i have tried shortening function name , typedef-ing return value.
class event_maker { public: virtual ~event_maker() {}; // 1 *this juts out far v virtual std::vector< std::unique_ptr< event > > transfer_events( void ) = 0; };
is there standard way reduce length, or make items distinguishable?
type aliases using typedef
can handy, example:
typedef std::unique_ptr<event> eventptr; typedef std::vector<eventptr> eventvector; virtual eventvector transfer_events( void ) = 0;
btw, need space between >>
, don't need after <
or before >
:
std::vector<std::pair<std::string, std::set<std::string> > >
update
as @snowhawk04 , @mkrieger1 pointed out in comments, modern compilers don't need space between >>
anymore. make sure use right compiler flags, example -std=c++0x
g++
. see more info about >>
, template aliases.
Comments
Post a Comment