- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试构建一个 Google OR-Tools OSX 10.11.3 上的示例
当我运行时:
g++ -I../include/ -L../lib -lortools -Wno-c++11-extensions nqueens2.cc
In file included from nqueens2.cc:25:
In file included from ../include/constraint_solver/constraint_solver.h:65:
In file included from ../include/base/hash.h:19:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/ext/hash_map:212:5: warning: Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map> [-W#warnings]
# warning Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>
^
In file included from nqueens2.cc:25:
In file included from ../include/constraint_solver/constraint_solver.h:65:
In file included from ../include/base/hash.h:20:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/ext/hash_set:205:5: warning: Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set> [-W#warnings]
# warning Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>
^
In file included from nqueens2.cc:25:
In file included from ../include/constraint_solver/constraint_solver.h:65:
../include/base/hash.h:184:31: error: expected expression
struct hash<std::array<T, N>> {
^
../include/base/hash.h:201:2: error: expected a type
};
^
2 warnings and 2 errors generated.
我认为问题在于编译器包含 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/ext/hash_map
当我希望它从 ../include
中包含它时。
导致错误的代码来自 ../include/base/hash.h
(Google OR-Tools 附带):
183 template <class T, std::size_t N>
184 struct hash<std::array<T, N>> {
185 public:
186 size_t operator()(const std::array<T, N>& t) const {
187 uint64 current = 71;
188 for (int index = 0; index < N; ++index) {
189 const T& elem = t[index];
190 const uint64 new_hash = hash<T>()(elem);
191 current = operations_research::Hash64NumWithSeed(current, new_hash);
192 }
193 return current;
194 }
195 // Less than operator for MSVC.
196 bool operator()(const std::array<T, N>& a, const std::array<T, N>& b) const {
197 return a < b;
198 }
199 static const size_t bucket_size = 4; // These are required by MSVC
200 static const size_t min_buckets = 8; // 4 and 8 are defaults.
201 };
202 #endif // STLPORT
203 } // namespace HASH_NAMESPACE
有什么想法吗?
最佳答案
旧的 g++ 编译器不允许连续两个 >
用于模板声明,因为它显示为 >>
运算符。因此,当您的代码查看结构声明时,它看到的是 {
大括号,而不是 >>>
运算符的表达式。这在后来的 c++ 标准中有所更改,g++ 也相应更改。
C++03 编译器要求将 >>
解释为右移运算符。这在 C++0x 标准中有所改变。
关于c++ - 如何修复 Google OR-Tools 中的 C++03 双尖括号模板语法错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35419183/
我遇到过如下代码: my $string = "fo2345obar"; $string =~ sg; 我不明白尖括号在这种情况下是什么意思;我之前看到的所有替换都是以下形式: $string =~
我正在尝试使用 VBA 计算特定单元格值在 Excel 电子表格中出现的次数。单元格值是一个 XML 标记,尖括号被函数解释为小于/大于。这些字符如何转义? 微软说: "您可以使用通配符、问号 (?)
这个问题在这里已经有了答案: What is the difference between parentheses, brackets and asterisks in Angular2? (3 个回
我正在阅读githab Flux Dispatcher 的源代码并找出尖括号语法: class Dispatcher { .... } 这是该语言的新功能还是像 typescript 一样的子集?这里
在类声明中,<> 尖括号和 swift 中声明的参数有什么用?就像: public class ClassName { } 最佳答案 它使类变得通用。 Swift 标准库没有很多泛型类的示例,但它有一
这个问题在这里已经有了答案: 关闭 9 年前。 Possible Duplicate: printing “” using html 如何在不调用 html 的情况下将 < 符号直接放入 html
为什么我要使用 class 语法: class nil b.foo #=> undefined method 简而言之,class 为给定对象打开一个实例类,允许为给定实例定义额外的实例方法,这些方
在类声明中,<> 尖括号和在 swift 中声明的参数有什么用?像这样: public class ClassName { } 最佳答案 它使类通用。 Swift 标准库没有很多泛型类的例子,但是它有
我正在学习Java,最近被尖括号(<>)难住了。它们到底是什么意思? public class Pool{ public interface PoolFactory{ publ
我正在学习Java,最近被尖括号(<>)难住了。它们到底是什么意思? public class Pool{ public interface PoolFactory{ publ
在“我的查询”中,其他开发人员使用 <> (angle brackets)这是什么意思? sb.append(" AND nvl(VoidFlag, 'N') <> 'Y' "); 最佳答案 <> 运
我正在使用 (Win 10) 捷克语键盘布局 (CES/CS),通常我能够通过右 alt (AltGR + 的组合来编写尖括号“>”。 ) 但现在 Visual Studio 2015 Communi
这个问题在这里已经有了答案: 13年前关闭。 Duplicate: ASP.NET "special" tags 我使用 PHP,它使用 或 作为服务器标签,但是ASP.NET的中的含义和用法是什么?
我是一名优秀的程序员,十分优秀!