变量隐藏在Boost Phoenix的嵌套let块中
Variable hiding within nested let blocks in Boost Phoenix
我在Boost Phoenix中嵌套let块时遇到了一些麻烦,当"内部"局部变量隐藏了"外部"局部变量。即使使用文档中的"Visibility"示例,如下所示:
#include <iostream>
#include <boost/phoenix.hpp>
namespace phoenix = boost::phoenix;
using namespace phoenix::local_names;
int main(int argc, char *argv[])
{
phoenix::let(_x = 1, _y = ", World")
[
phoenix::let(_x = "Hello") // hides the outer _x
[
std::cout << _x << _y // prints "Hello, World"
]
]();
return 0;
}
我收到以:
开头的错误GCC: "error: function returning an array"
Clang: "error: function cannot return array type 'result_type' (aka 'char [6]')"
有人知道我如何在Phoenix的内部let块范围内"影子"这样的变量吗?我目前使用Ubuntu 13.04与GCC版本4.8快照;铿锵声3.2;增加1.49;以及Boost 1.53。
这绝对是Phoenix中的一个bug。以下编译:
int y = 0;
int x = (phoenix::let(_a = 1, _b = 2)[phoenix::let(_b = _1)[ _a ]])(y);
int y = 0;
int x = (phoenix::let(_a = 1, _b = 2)[phoenix::let(_b = 3)[ _a ]])(y);
怪异。你可以在https://svn.boost.org/trac/boost/上提交bug(点击"New Ticket")吗?谢谢。(注意:我不是维护人员)
相关文章:
- 嵌套在类中时无法设置成员数据
- 无法访问嵌套类.类的使用无效
- 我正在使用嵌套的while循环来解析具有多行的文本文件,但由于某种原因,它只通过第一行,我不知道为什么
- 如何在C++中初始化嵌套类中的2个memeber
- 如何声明特征矩阵,然后通过嵌套循环初始化它
- 在C++中搜索嵌套多映射值
- 在C++中将矢量转换为嵌套地图
- C++嵌套if语句,基本货币交换
- 在nlohmann json中,如何将嵌套对象的数组转换为嵌套结构的向量
- 嵌套的匿名命名空间
- 了解嵌套循环打印星号图案
- 如何使用boost::具有嵌套结构和最小代码更改的序列化
- 嵌套for循环C++的问题(初学者)
- 从嵌套在std::映射中的std::列表中删除元素的最佳方式
- 用C#中的并集模拟C++嵌套结构
- 部分专业化和嵌套模板
- 嵌套While循环不起作用(C++问题)
- C++-模板嵌套类的引用初始化无效
- 如何在嵌套类中正确使用友元声明?
- 变量隐藏在Boost Phoenix的嵌套let块中