Talk:cpp/chrono/duration/count

In examples I've seen for chrono::duration.count in appears to return a double. However, when I try to pass that double into another function, nothing seems to happen. The code compiles and there are no runtime errors. What data type does it return? { cout << convTi(elapsed_seconds.count) << endl;

string convTi(double seconds) { string result; result = "Cool! it compiles!"; result += seconds; result += "<--Where is the number"; return result; } }

Ceh2624 (talk) 08:38, 6 November 2014 (PST)


 * As written on this page, duration::count returns duration::rep, a type alias to the first template parameter of std. In the example on this page, the first two counts return integers and the third count returns a double. In your code, what do you expect to do and why?--Cubbi (talk) 08:47, 6 November 2014 (PST)


 * The page should probably at least link to rep in some way, to easily find an explanation of what it is. Kumiponi (talk) 11:47, 6 November 2014 (PST)


 * That is a wiki-wide issue with all library member functions that return member typedefs, e.g. std or std or std. The member typedefs are defined inline on the class's own page, and don't offer a way to link to them. Perhaps this should be brought up on Talk:Main_Page to gather ideas on how it could be worked into the wiki (or perhaps it will be discussed right here). --Cubbi (talk) 12:42, 6 November 2014 (PST)