Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/152.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ c+中的分配器错误+; 名称空间测试 { 模板 班级名单 { 私人: 结构体类型 { 节点*下一步; 数据类型数据; 节点(数据类型数据,节点*next=nullptr); }; typename分配器::模板重新绑定::其他分配器; 节点*头; 整数大小; 公众: List(); ~List(); void PushFront(数据类型数据); //无效插入(数据类型数据、大小和索引); //无效删除索引(大小索引); 模板 friend std::ostream&operator_C++_Templates_Memory Management - Fatal编程技术网

C++ c+中的分配器错误+; 名称空间测试 { 模板 班级名单 { 私人: 结构体类型 { 节点*下一步; 数据类型数据; 节点(数据类型数据,节点*next=nullptr); }; typename分配器::模板重新绑定::其他分配器; 节点*头; 整数大小; 公众: List(); ~List(); void PushFront(数据类型数据); //无效插入(数据类型数据、大小和索引); //无效删除索引(大小索引); 模板 friend std::ostream&operator

C++ c+中的分配器错误+; 名称空间测试 { 模板 班级名单 { 私人: 结构体类型 { 节点*下一步; 数据类型数据; 节点(数据类型数据,节点*next=nullptr); }; typename分配器::模板重新绑定::其他分配器; 节点*头; 整数大小; 公众: List(); ~List(); void PushFront(数据类型数据); //无效插入(数据类型数据、大小和索引); //无效删除索引(大小索引); 模板 friend std::ostream&operator,c++,templates,memory-management,C++,Templates,Memory Management,尝试更改 int main() { Test::List<int> l; l.PushFront(10); l.PushFront(20); } typename分配器::模板重新绑定::其他分配器; 到 typename分配器::模板重新绑定::其他分配器; 指针是隐式的 另外,您应该将std::allocator\u traits与分配器一起使用,而不是直接使用分配器的typedef和函数。尝试更改 int main() { Test::Li

尝试更改

int main()
{
    Test::List<int> l;
    l.PushFront(10);
    l.PushFront(20);
}
typename分配器::模板重新绑定::其他分配器;

typename分配器::模板重新绑定::其他分配器;
指针是隐式的

另外,您应该将
std::allocator\u traits
与分配器一起使用,而不是直接使用分配器的typedef和函数。

尝试更改

int main()
{
    Test::List<int> l;
    l.PushFront(10);
    l.PushFront(20);
}
typename分配器::模板重新绑定::其他分配器;

typename分配器::模板重新绑定::其他分配器;
指针是隐式的

您还应该将
std::allocator\u traits
与分配器一起使用,而不是直接使用分配器的typedef和函数

typename Allocator::template rebind<Node*>::other allocator;
typename Allocator::template rebind<Node>::other allocator;