数组中的两个元素,如何使用in_array()测试值并回显不同的值。
$b = "Mac";
$os = array($c, "Linux");
if (in_array($b, $os)) {
//if($b==$c); want to echo Linux as out value
}
我不喜欢和和或者.有长的代码。
有什么想法吗?
如何使用boost::assign::list_of将值放入std::vector<std::vector<int> >类型的对象?或者,对于我如何为单元测试的目的填充它,您有什么其他建议吗?
更新
我得到以下gcc 4.4.2的编译器错误
gcc/4.4.2/lib/gcc/x86_64-unknown-linux-gnu/4.4.2/../../../../include/c++/4.4.2/bits/stl_uninitialized.h: In static member function 'static _ForwardIterator std::__
我对$有问题(foreach.)和回声功能。我试图迭代一个变量并将其附加到一个文件中。
这是我的代码:
vars = a b c d
all:
@$(foreach var, $(vars), echo $(var) >> variables.txt)
生成的文件看起来像
a echo b echo c echo d
我不知道为什么它也打印“回声”这个词,为什么它在同一条线上。
我正在Windows上工作,linux上的结果和预期的一样。
我在这里错过了什么?
谢谢。
原始字符串为:
csrfToken=ajax:1238044988226892967&postTitle=Job Openings Linux Systems Administrator
Staff&postText=Security Clearance: Public Trust -- Linux systems administration experience specifically in managing or supporting RedHat and/or Centos Linux in...&pollChoice1-
ANetPostForm=
平台:
Ubuntu12.04 amd64,gcc,arm-linux-gnueabi-gcc
使用的库:
FreeBSD库
问题:
我在研究FreeBSD图书馆。()
当我使用LIST_FOREACH_SAFE时,我得到了编译错误,我不知道如何修复这个错误。
错误输出:
test.c:39: error: ‘entries’ undeclared (first use in this function)
test.c:39: error: (Each undeclared identifier is reported only once
test.c:39: error: for each