我遇到了类的问题,将一个const对象(多态结构)传递给一个显式构造函数,该构造函数对该多态结构的基类进行了const引用.这是示例(这不是我的代码,这里是解释)
class Base
{
...
}
class Derived:public Base
{
...
}
class Problem
{
Problem(const Base&);
...
}
void myFunction(const Problem& problem)
{
...
}
int main()
{
//explicit constructor with non const object
Derived d;
Problem no1(d); //this is working fine
myFunction(no1);
//implicit constructor with const object
Problem no2=Derived(); //this is working fine, debugged and everything called fine
myFunction(no2); //is working fine
//explicit constructor with const object NOT WORKING
Problem no3(Derived()); //debugger jumps over this line (no compiler …Run Code Online (Sandbox Code Playgroud) 我有一个没有此扩展程序的平台(非NVIDIA).我怎么能模仿这个功能?我需要它来解决使用z-fail算法渲染模板阴影卷时的远平面剪裁问题.