Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

practice 13.56 how to understand ? #790

Open
wangxinzzz opened this issue Dec 20, 2020 · 1 comment
Open

practice 13.56 how to understand ? #790

wangxinzzz opened this issue Dec 20, 2020 · 1 comment

Comments

@wangxinzzz
Copy link

if define a not const & version function ,call this funtion still cause Infinite recursion .what the parctice want to say?

class Foo {
public:
   // Foo sorted() const &;
    Foo sorted() {
       Foo ret;
       return ret.sorted();
   }
};
int main(int arg, char **args) {

    Foo f;
    f.sorted();
    return 0;
}

image

@wangxinzzz
Copy link
Author

with 13.57 got some idea , does it mean the Foo class still have Foo sorted() && ; so 13.56 will crash and 13.56 run fine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant