我正在调用模板,并传递如下参数:
<ui:include src="WEB-INF/Subviews/ProductEdit.xhtml">
<ui:param name="items" value="#{produtList}"></ui:param>
<ui:param name="itemToEdit" value="#{productToEdit}"></ui:param>
</ui:include>
Run Code Online (Sandbox Code Playgroud)
在ProductEdit.xhtml中,我有类似的东西
<ui:repeat value="#{items}" var="item">
<tr>
...
...
<td style="text-align: center">
<h:commandLink style="cssGenericColumn" action="#{productEditAction}">
<f:setPropertyActionListener target="#{itemToEdit}" value="#{item}"/>
</h:commandLink>
</td>
<tr>
</ui:repeat>
Run Code Online (Sandbox Code Playgroud)
哪个工作正常.
我现在想在ProductEdit.xhtml中参数化#{productEditAction},所以我做了以下
<ui:include src="WEB-INF/Subviews/ProductEdit.xhtml">
<ui:param name="items" value="#{produtList}"></ui:param>
<ui:param name="itemToEdit" value="#{productToEdit}"></ui:param>
<ui:param name="itemEditAction" value="#{productEditAction}"></ui:param>
</ui:include>
Run Code Online (Sandbox Code Playgroud)
在第一页然后在ProductEdit.xhtml中我做
<ui:repeat value="#{items}" var="item">
<tr>
...
...
<td style="text-align: center">
<h:commandLink style="cssGenericColumn" action="#{itemEditAction}">
<f:setPropertyActionListener target="#{itemToEdit}" value="#{item}"/>
</h:commandLink>
</td>
<tr>
</ui:repeat>
Run Code Online (Sandbox Code Playgroud)
这导致以下错误失败
javax.faces.el.EvaluationException: /WEB-INF/Subviews/ProductEdit.xhtml @45,89 action="#{itemEditAction}": Identity 'itemEditAction' does not reference a MethodExpression instance, returned type: java.lang.String …
Run Code Online (Sandbox Code Playgroud) 这个问题不是关于C++语言本身(即不是关于标准),而是关于如何调用编译器来实现虚函数的替代方案.
实现虚函数的一般方案是使用指向指针表的指针.
class Base {
private:
int m;
public:
virtual metha();
};
Run Code Online (Sandbox Code Playgroud)
等价地说C会是这样的
struct Base {
void (**vtable)();
int m;
}
Run Code Online (Sandbox Code Playgroud)
第一个成员通常是指向虚拟函数列表等的指针(应用程序无法控制的内存中的一块区域).在大多数情况下,这会在考虑成员之前花费指针的大小等等.因此在大约4个字节的32位寻址方案中等等.如果在应用程序中创建了40k多态对象的列表,则大约为40k x在任何成员变量等之前4个字节= 160k字节.我也知道这恰好是C++编译中最快和最常见的实现.
我知道多重继承很复杂(尤其是虚拟类,即菱形结构等).
另一种方法是将第一个变量作为vptrs表的索引id(等效于C,如下所示)
struct Base {
char classid; // the classid here is an index into an array of vtables
int m;
}
Run Code Online (Sandbox Code Playgroud)
如果应用程序中的类总数小于255(包括所有可能的模板实例化等),则char足以保存索引,从而减少应用程序中所有多态类的大小(我排除了对齐问题)等).
我的问题是,在GNU C++,LLVM或任何其他编译器中是否有任何切换来执行此操作?或减少多态对象的大小?
编辑:我了解指出的对齐问题.还有一点,如果这是64位系统(假设为64位vptr),每个多态对象成员的成本约为8字节,那么vptr的成本就是内存的50%.这主要涉及大量创建的小型多态,所以我想知道如果不是整个应用程序,这个方案是否至少可以用于特定的虚拟对象.
c++ compiler-construction micro-optimization compiler-optimization vptr
有什么区别
select empName as EmployeeName from employees
Run Code Online (Sandbox Code Playgroud)
与
select EmployeeName = empName from employees
Run Code Online (Sandbox Code Playgroud)
从技术角度来看.不确定这是否只是SQL服务器特定的.
感谢您的回答.
我知道确实没有什么区别,但是'LEFT JOIN'是ANSI表格还是有任何RDBMS会失败'LEFT JOIN'并要求'LEFT OUTER JOIN'.[我在这里问,所以我可以保存几次点击,填写表格等,以获得正确的ANSI标准!]