Tuesday, July 6, 2010

C++ constant temporary lifetime

Programmer Question

hello.



Can you please tell me if such code is correct (according to standard):



struct array {
int data[4];
operator const int*() const { return data; }
};

void function(const int*) { ... }

function(array()); // is array data valid inside function?


Thank you



Find the answer here

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails