[Cs3] auto vs. decltype

Mikhail Nesterenko mikhail at cs.kent.edu
Wed Aug 29 18:49:38 EDT 2018


CS3 students,

This is regarding the discussion on the last lecture. auto is to
declare variable while decltype may be used without variable
declaration. 

For example

    std::vector<decltype(func())>;

declares a vector of whatever func() returns. More detailed answer can
be found in stackoverflow here:

   https://stackoverflow.com/questions/12084040/decltype-vs-auto

Thanks,
-- 
Mikhail


More information about the cs3 mailing list