type_traits(1545):错误C2280: [英] type_traits(1545): error C2280:

查看:98
本文介绍了type_traits(1545):错误C2280:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

vs2013,这是错误的:

vs2013,it's wrongs:

D:\vs2013\VC\include\type_traits(1545): error C2280: "std::basic_stringstream<char,std::char_traits<char>,std::allocator<char>>::basic_stringstream(const std::basic_stringstream<char,std::char_traits<char>,std::allocator<char>> &)": 尝试引用已删除的函数
        1>          D:\vs2013\VC\include\sstream(631) : 参见"std::basic_stringstream<char,std::char_traits<char>,std::allocator<char>>::basic_stringstream"的声明
        1>          D:\vs2013\VC\include\thread(47): 参见对正在编译的函数 模板 实例化"std::basic_stringstream<char,std::char_traits<char>,std::allocator<char>> std::_Decay_copy<std::stringstream&>(_Ty)"的引用
        1>          with
        1>          [
        1>              _Ty=std::stringstream &
        1>          ]
        1>          GA_SpikeDlg.cpp(253): 参见对正在编译的函数 模板 实例化"std::thread::thread<float(__cdecl &)(M_args,double,double,double,double,int [],M_args_Bound [],int,float,float,int,float,float,std::stringstream &),M_args&,double&,double&,double&,double&,int(&)[5],M_args_Bound(&)[5],int&,float&,float&,const int&,float&,float&,std::stringstream&>(_Fn,M_args &,double &,double &,double &,double &,int (&)[5],M_args_Bound (&)[5],int &,float &,float &,const int &,float &,float &,std::stringstream &)"的引用
        1>          with
        1>          [
        1>              _Fn=float (__cdecl &)(M_args,double,double,double,double,int [],M_args_Bound [],int,float,float,int,float,float,std::stringstream &)
        1>          ]
        1>  GA_Spike.cpp
        1>  cuda_transfer.cpp
        1>  正在生成代码...
        ========== 全部重新生成:  成功 0 个,失败 1 个,跳过 0 个 ==========

我的主要代码是:

thread t1(task1, Parameter_, Mtime, tempVB, TimeStep, m_I, FlagParameter, Parameter_Bound, MaxGeneration, gL, C, POPULATION_SIZE, crossver, mutations, strResult);

void task1(M_args Parameter_, double Mtime, double tempVB, double TimeStep, double m_I, int FlagParameter[], M_args_Bound Parameter_Bound[], int MaxGeneration, float gL, float C, const int POPULATION_SIZE, float crossver, float mutations, stringstream &strResult)
{
solveGPU_cpp(Parameter_, Mtime, tempVB, TimeStep, m_I, FlagParameter, Parameter_Bound, MaxGeneration, gL, C, POPULATION_SIZE, crossver, mutations, strResult);
    cout << "task1 says: " << endl;
}

AND resolveGPU_cpp是.cu的接口功能 那怎么了?

AND solveGPU_cpp is a Interface functions of .cu so what's wrong?

推荐答案

最后一个参数是引用,您需要std::ref(strResult).

The last parameter is by reference you need std::ref(strResult).

赞:

thread t1(task1, Parameter_, Mtime, tempVB, TimeStep, m_I, FlagParameter, Parameter_Bound, MaxGeneration, gL, C, POPULATION_SIZE, crossver, mutations,
  std::ref(strResult));    // Pass reference

在此快速&肮脏的操场- https://godbolt.org/g/iQzJPH

Here a quick & dirty playground - https://godbolt.org/g/iQzJPH

这篇关于type_traits(1545):错误C2280:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆