Monday 15 June 2015

c++ - returning initializer list mechanism -


What mechanism is included, if the incoming type, which are created from the initial list, I do not specify that type While returning, such as:

  std :: arrays and lt; Int, 3 & gt; Make_array () {Return {1, 2, 3}; }   

instead of

  std :: arrays and lt; Int, 3 & gt; Make_array () {return std :: array & lt; Int, 3 & gt; {1, 2, 3}; }   

If the initial list is returned without specifying a type, then does it contain any performance penalties? Am I really returning an array, which is the std :: arrays

Does that change?

There is no performance penal in it. Return value

  std :: arrays and lt; Int, 3 & gt; Has been made equal. X = {1, 2, 3};   

No copy or a std :: array example is included

No comments:

Post a Comment