Aggregate initialization with Urho3D containers

Everything about the development of Urho3D.

Re: Aggregate initialization with Urho3D containers

PostPosted by rku » 30 Apr 2016, 14:57

What i proposed is proper way of doing things. That template function is abuse of programming language. It is counter-intuitive as well as possibly generating bloat because thats what c++ templates do. Yes, it saves two characters, but at what expense?
User avatar
rku
Active user
Active user
 
Posts: 103
Joined: 06 May 2015, 08:24

Re: Aggregate initialization with Urho3D containers

PostPosted by sabotage3d » 30 Apr 2016, 23:36

Templates are the way to go especially in C++11 and C++14. The only clean way of doing inifinite number of arbitary arguments are variadic templates.
User avatar
sabotage3d
Have many posts
Have many posts
 
Posts: 515
Joined: 25 Oct 2014, 13:26

Re: Aggregate initialization with Urho3D containers

PostPosted by weitjong » 01 May 2016, 03:44

I would just address your concern of the code bloat part. I believe it is actually unfounded. I have briefly explained in my previous comment why I believe that. I can even confirm that because I had already done the unit test before submitting the patch. In my test it showed that the generated assembly code from the variadic template (when fully optimized using -O3) had resolved all the recursive calls and all the functions were being inlined as if I had written all the boilerplate code by hand.
YaoWT - Leave no window unbroken ♪ (^。^) 
User avatar
weitjong
Contributor
Contributor
 
Posts: 1094
Joined: 16 Jan 2014, 15:34
Location: Singapore, 新加坡

Previous

Return to Developer Talk

Who is online

Users browsing this forum: No registered users and 0 guests

cron