常量引用如何产生影响?(How does constant reference makes a difference?)
我不明白为什么以下代码不起作用:
#include <iostream> using namespace std; class PayOff{}; class PayOffCall : public PayOff{}; class PayOffBridge{ public: PayOffBridge( PayOff& innerPayOff){}; }; class VanilaOption{ public: VanilaOption(PayOffBridge& ThePayOff_){cout << " test " <<endl;} }; int main () { PayOffCall thePayOff; VanilaOption theOption(thePayOff); return 0; }
出于某种原因,在VanilaOption类(下面的代码)中更改对const的引用使其工作,有人可以解释它是如何工作的吗? 我得到的错误是: 没有匹配函数来调用'VanilaOption :: VanilaOption(PayOffCall&)'
但它并没有帮助我弄明白。
class VanilaOption{ public: VanilaOption(const PayOffBridge& ThePayOff_){cout << " test " <<endl;} };
我也不明白为什么在PayOffBridge引用预期有效时通过PayOffCall引用,有人可以帮我解决这个问题吗?
谢谢!
I dont understand why the following code doesn't work:
#include <iostream> using namespace std; class PayOff{}; class PayOffCall : public PayOff{}; class PayOffBridge{ public: PayOffBridge( PayOff& innerPayOff){}; }; class VanilaOption{ public: VanilaOption(PayOffBridge& ThePayOff_){cout << " test " <<endl;} }; int main () { PayOffCall thePayOff; VanilaOption theOption(thePayOff); return 0; }
For some reason changing the reference to const in VanilaOption class (code below) makes it work, can someone explain how does it work? The error I get is: no matching function for call to 'VanilaOption::VanilaOption(PayOffCall&)'
but it doesn't help me to figure it out.
class VanilaOption{ public: VanilaOption(const PayOffBridge& ThePayOff_){cout << " test " <<endl;} };
I also don't understand why passing PayOffCall reference when PayOffBridge reference is expected works, can someone help me out on this?
Thank you!
原文:https://stackoverflow.com/questions/34583750
满意答案
简答:您必须编写自己的模板。
更长的答案:
Django确实包含了一些模板,但这些模板都仅用于管理应用程序。 auth视图默认使用'registration / some_template.html',这些模板都存在于admin应用程序中(请参阅https://github.com/django/django/tree/master/django/contrib/admin/templates/registration )。 auth视图都支持您可以在URLConf中提供的
template
关键字参数,以便您可以指定要使用的模板。将管理模板视为您在编写自己的模板时可以使用的参考,但不是您想要直接使用的参考。
Short answer: You have to write your own templates.
Longer answer:
Django does include some templates, but these are all intended solely for the admin application. The auth views default to using 'registration/some_template.html', and those templates all live in the admin app ( see https://github.com/django/django/tree/master/django/contrib/admin/templates/registration). The auth views all support a
template
keyword argument that you can supply in your URLConf, so that you can specify which of your own templates to use.Think of the admin templates as a reference that you can use when writing your own templates, but not as something you're meant to use directly.
相关问答
更多django模板:扩展模板能够在父页面中更改css吗?(django template: Is extended template able to change css in parent page?)
寻找提供django模板的资源(Looking for a resource which provides django templates [closed])
使用Django模板标签的Mako模板(Mako templates using Django template tags)
django模板中的函数(functions in django templates)
django模板可以找到它的命名url,还是基本模板可以知道哪个模板正在扩展它?(Can a django template find out its named url or can a base template know which template is extending it?)
哪个Django模板布局更好?(Which Django template layout is better? [closed])
Django模板 - 停止处理模板(Django Template - Stop processing template)
django如何使用模板(django how to work with templates)
在django中实现shopify模板(Implement shopify templates in django)
根据我的设计更改django扩展模板以提供所有提供的模板(Changing django extended template to have all provided templates according to my design)
相关文章
更多Becoming a data scientist
Become a Master Designer: Rule Three: Contrast, Contrast, Contrast
trouble is a friend
Book Report: THE SOUL OF A NEW MACHINE
Spring Data: a new perspective of data operations
How to Start a Business in 10 Days
A Great List of Windows Tools
Create a Bootable MicroSD Card
每日英语:Man Without a Country
7.trouble is a friend(Lenka)
最新问答
更多获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
如何通过引用返回对象?(How is returning an object by reference possible?)
矩阵如何存储在内存中?(How are matrices stored in memory?)
每个请求的Java新会话?(Java New Session For Each Request?)
css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
xcode语法颜色编码解释?(xcode syntax color coding explained?)
在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
Copyright ©2023 peixunduo.com All Rights Reserved.粤ICP备14003112号
本站部分内容来源于互联网,仅供学习和参考使用,请莫用于商业用途。如有侵犯你的版权,请联系我们(neng862121861#163.com),本站将尽快处理。谢谢合作!