mirror of
https://github.com/boostorg/fusion.git
synced 2025-07-04 16:16:31 +02:00
39 lines
1005 B
C++
39 lines
1005 B
C++
/*=============================================================================
|
|
Copyright (c) 2018 Kohei Takahashi
|
|
|
|
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/fusion/include/vector.hpp>
|
|
#include <boost/fusion/include/transform.hpp>
|
|
#include <boost/mpl/quote.hpp>
|
|
#include <boost/mpl/placeholders.hpp>
|
|
|
|
using namespace boost::fusion;
|
|
|
|
template <typename>
|
|
struct predicate {};
|
|
|
|
struct unique {};
|
|
|
|
template <typename>
|
|
struct meta_func
|
|
{
|
|
typedef unique result_type;
|
|
|
|
template <typename T>
|
|
unique operator()(const T&) const;
|
|
};
|
|
|
|
int main()
|
|
{
|
|
vector<int> v;
|
|
|
|
typedef predicate<boost::mpl::_1> lambda_t;
|
|
typedef boost::mpl::quote1<predicate> quote_t;
|
|
|
|
vector<unique> l = transform(v, meta_func<lambda_t>());
|
|
|
|
vector<unique> q = transform(v, meta_func<quote_t>());
|
|
}
|