|
-
February 7th, 2016, 07:28 AM
#14
Re: concatenate int value from vector to long long int
 Originally Posted by 2kaud
With VS2015 this gives "error C2146: syntax error: missing ']' before identifier 'Cn'". Although [&Cn] is OK.
Sorry, it's a typo. I should be [Cn]. This means Cn is captured by value. I'll modify my post.
Yet another way! This though is probably the easier to read. I would be interested in guru's views regarding the performance of these various methods.
It's not just "yet another way". There's a huge qualitative difference where in my view the range-based for-loop is the outstanding winner in this particular example. It's much easier to understand and get right than the function approach where the increased code complexity adds an extra layer of potential mistakes.
Regarding performance, I'd say an optimizing compiler most likely will generate pretty much the same code in both cases.
Last edited by tiliavirga; February 7th, 2016 at 07:31 AM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|