小编Dal*_*sky的帖子

android include标签 - 无效的布局参考

我有一个问题,包括通过android布局xml文件中的include标签的不同布局.在指定布局引用(@layout/...)时,我在Eclipse ADT中遇到以下错误的 InflateException:InflateException:您必须指定有效的布局引用.布局ID @ layout/func_edit_simple_calculator_toolbox无效.

引用应该是有效的,因为我从我的其他布局列表中选择它并且没有输入它.我正在使用android sdk v2.1

这些是布局文件

func_edit_simple_calculator_toolbox.xml

<?xml version="1.0" encoding="utf-8"?>
<TableLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_height="wrap_content" android:layout_width="wrap_content">

<TableRow android:id="@+id/TableRow01" android:layout_width="wrap_content"android:layout_height="wrap_content">
<Button android:id="@+id/Button01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="1"></Button>
<Button android:id="@+id/Button02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="2"></Button>
<Button android:id="@+id/Button03" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="3"></Button>
<Button android:id="@+id/Button04" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="+"></Button>
</TableRow>
<TableRow android:id="@+id/TableRow02" android:layout_width="wrap_content" android:layout_height="wrap_content">
<Button android:id="@+id/Button05" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="4"></Button>
<Button android:id="@+id/Button06" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="5"></Button>
<Button android:id="@+id/Button07" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="6"></Button>
<Button android:id="@+id/Button08" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="-"></Button>
</TableRow>
</TableLayout>
Run Code Online (Sandbox Code Playgroud)

function_editor_layout.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >

<com.calculoid.FunctionView …
Run Code Online (Sandbox Code Playgroud)

xml layout android

42
推荐指数
2
解决办法
3万
查看次数

寻找特殊的C++数据结构

我正在寻找符合以下标准的数据结构(或数据结构组合)的C++实现:

  • 以与std :: vector相同的方式访问项目
  • 提供随机访问迭代器(以及迭代器比较<,>)
  • 平均项目访问(:查找)时间最O(log(n))复杂
  • 项目按照与添加到容器中相同的顺序进行迭代
  • 给定一个迭代器,我可以找出容器中指向的项的序数位置,最糟糕的是O(log(n))复杂性
  • 提供项目插入和移除在最复杂的特定位置O(log(n))
  • 删除/插入项目不会使先前获得的迭代器无效

提前感谢您的任何建议

DALIBOR

(编辑)答案:

我选择的答案描述了满足所有这些要求的数据结构.然而,正如Maxim Yegorushkin所建议的那样,boost :: multi_index提供的功能非常接近上述功能.

(编辑)未正确指定某些要求.他们根据更正修改(:原创)

(编辑)我发现了接受的答案中描述的数据结构的实现.到目前为止,它按预期工作.它被称为计数器树

(编辑)考虑使用sp2danny建议的AVL-Array

c++ complexity-theory iterator data-structures

8
推荐指数
1
解决办法
614
查看次数

"abc"[0]不是编译时常量

我有这个代码:

template< char... chars >
struct VariadicTemplate
{};


int
main()
{
    VariadicTemplate< "abc"[ 0 ], "abc"[ 1 ], "abc"[ 2 ] >  v;
}
Run Code Online (Sandbox Code Playgroud)

这与mingw-w64 4.8.1编译良好.但是,同样不能在MSVC 2013下编译,也不能在VC++ 11月CTP编译时出错:

错误1错误C2975:'chars':'VariadicTamplate'的模板参数无效,预期的编译时常量表达式

哪个"不"或"部分"指的是这个? http://blogs.msdn.com/b/vcblog/archive/2013/12/02/c-11-14-core-language-features-in-vs-2013-and-the-nov-2013-ctp. ASPX

如果没有,这是编译器错误吗?

c++ mingw visual-c++ c++11

5
推荐指数
1
解决办法
249
查看次数