liutang123 opened a new pull request, #24062:
URL: https://github.com/apache/doris/pull/24062
## Proposed changes
If exec `shared_from_this()` in an object of class that extends from a class
witch extends `enable_shared_from_this`, it will return an object of shared_ptr
of its super class.
Here is a code example.
```
#include <iostream>
using namespace std;
class SS;
class SSS;
void func(std::shared_ptr<SS> s);
void func(std::shared_ptr<SSS> s);
class SS : public std::enable_shared_from_this<SS> {};
class SSS : public SS {
public:
void do_func() {
func(shared_from_this()); // this shared_from_this() returns
an shared_ptr<SS>
}
};
void func(std::shared_ptr<SS> s) {
std::cout << "SS" << endl;
}
void func(std::shared_ptr<SSS> s) {
std::cout << "SSS" << endl;
}
int main() {
auto sss = std::make_shared<SSS>();
sss->do_func();
}
```
This code will print `SS`.
Issue Number: close #xxx
<!--Describe your changes.-->
## Further comments
If this is a relatively large or complex change, kick off the discussion at
[[email protected]](mailto:[email protected]) by explaining why you
chose the solution you did and what alternatives you considered, etc...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]