We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
using std::string; mystl::vector<string> v3;
如上代码所示,当定义v3变量时,编译器报错:
In template: call to function 'destroy' that is neither visible in the template definition nor found by argument-dependent lookup
即在如下位置:
MyTinySTL/MyTinySTL/construct.h
Line 62 in acc07e0
template <class ForwardIter> void destroy_cat(ForwardIter first, ForwardIter last, std::false_type) { for (; first != last; ++first) destroy(&*first); }
此处应该是因为编译找不到destroy函数的声明,因为destroy定义在后面。所以,我认为应该在这个函数前面加上一个声明,即如下所示:
template<class Ty> void destroy(Ty *pointer); template <class ForwardIter> void destroy_cat(ForwardIter first, ForwardIter last, std::false_type) { for (; first != last; ++first) destroy(&*first); }
加上之后,编译器就不再报错了,也能运行了~ 不知道这算不算一个bug。如果确实需要修复,能不能让我提个pr来修复一下(我会看一下pr规范的)
The text was updated successfully, but these errors were encountered:
我认为析构单个对象的函数应该叫 destroy_at (我们可以引入新函数,然后弃用旧的析构单对象版本)。 另外应该用类似 std::addressof 的机制避免 ADL 和重载 operator& 的问题。
destroy_at
std::addressof
operator&
Sorry, something went wrong.
No branches or pull requests
如上代码所示,当定义v3变量时,编译器报错:
即在如下位置:
MyTinySTL/MyTinySTL/construct.h
Line 62 in acc07e0
提示找不到destroy
此处应该是因为编译找不到destroy函数的声明,因为destroy定义在后面。所以,我认为应该在这个函数前面加上一个声明,即如下所示:
加上之后,编译器就不再报错了,也能运行了~
不知道这算不算一个bug。如果确实需要修复,能不能让我提个pr来修复一下(我会看一下pr规范的)
The text was updated successfully, but these errors were encountered: