24,855
社区成员
发帖
与我相关
我的任务
分享
namespace phx = boost::phoenix;
using phx::arg_names::arg1;
std::vector<std::string> greets{ "Hello", "Hola", "Hujambo",
"Hallo" };
auto finder = phx::find(greets, arg1);
auto it = finder("Hujambo");
assert(phx::end(greets)() != it); //Assert失败, 不太清楚为什么.
std::cout << *it << '\n';
assert(++it != greets.end());
std::cout << *it << '\n';
return 0;
#include <iostream>
#include <vector>
#include <boost/phoenix/stl/container.hpp>
#include <boost/phoenix/stl/algorithm.hpp>
#include <boost/phoenix/core/argument.hpp>
int main(int argc, char* argv[]) {
namespace phx = boost::phoenix;
using phx::arg_names::arg1;
std::vector<std::string> greets{ "Hello", "Hola", "Hujambo",
"Hallo" };
auto finder = phx::find(greets, arg1);
auto it = finder("Hujambo");
assert(phx::end(greets)() != it); //Assert失败, 不太清楚为什么.
std::cout << *it << '\n';
assert(++it != greets.end());
std::cout << *it << '\n';
return 0;
}