filter.cpp

来自「Boost provides free peer-reviewed portab」· C++ 代码 · 共 44 行

CPP
44
字号
/*=============================================================================    Copyright (c) 2001-2006 Joel de Guzman    Copyright (c) 2005-2006 Dan Marsden    Distributed under the Boost Software License, Version 1.0. (See accompanying     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)==============================================================================*/#include <boost/detail/lightweight_test.hpp>#include <boost/fusion/container/vector/vector.hpp>#include <boost/fusion/adapted/mpl.hpp>#include <boost/fusion/sequence/io/out.hpp>#include <boost/fusion/container/generation/make_vector.hpp>#include <boost/fusion/sequence/comparison/equal_to.hpp>#include <boost/fusion/algorithm/transformation/filter.hpp>#include <boost/mpl/vector.hpp>intmain(){    using namespace boost::fusion;    std::cout << tuple_open('[');    std::cout << tuple_close(']');    std::cout << tuple_delimiter(", ");    typedef boost::fusion::vector<char,double,char> vector_type;    vector_type t('a', 6.6, 'b');    {        std::cout << filter<char>(t) << std::endl;        BOOST_TEST((filter<char>(t)            == make_vector('a', 'b')));    }    {        typedef boost::mpl::vector<char,double,char> mpl_vec;        BOOST_TEST((filter<char>(mpl_vec())            == make_vector('\0', '\0')));    }    return boost::report_errors();}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?