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

请教一下 /base/LogFile.cpp 中 reset 函数 #2

Closed
bobbymly opened this issue Feb 27, 2018 · 1 comment
Closed

请教一下 /base/LogFile.cpp 中 reset 函数 #2

bobbymly opened this issue Feb 27, 2018 · 1 comment

Comments

@bobbymly
Copy link

/base/LogFile.cpp
19: file_.reset(new AppendFile(basename));

这一句没看懂
file_ 是一个AppendFile类型的指针成员 却使用了 . 运算符
而且 ApendFile 类中 并没有定义 reset 方法

@linyacool
Copy link
Owner

@bobbymly file_ 成员是智能指针std::unique_ptr, 智能指针本身是一个对象,所以有"."运算符,我们能用->是因为智能指针帮我们重载了->,才得以直接访问指针指向的内容

@bobbymly bobbymly closed this as completed Mar 6, 2018
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

2 participants