1/*=============================================================================
2 Copyright (c) 2017 Paul Fultz II
3 virtual_base.cpp
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6==============================================================================*/
7#include <boost/hof/flip.hpp>
8#include <boost/hof/proj.hpp>
9#include <boost/hof/construct.hpp>
10#include <boost/hof/pipable.hpp>
11#include <boost/hof/rotate.hpp>
12#include "test.hpp"
13
14struct base {
15 base(int) {}
16 base(const base&) {}
17 virtual ~base();
18};
19
20base::~base() {}
21
22struct derived : virtual base {
23 derived() : base(1) {}
24 derived(const derived&) : base(1) {}
25 int operator()(int i, void *) const {
26 return i;
27 }
28 ~derived();
29};
30derived::~derived() {}
31
32BOOST_HOF_TEST_CASE()
33{
34 BOOST_HOF_TEST_CHECK(boost::hof::flip(derived())(nullptr, 2) == 2);
35 BOOST_HOF_TEST_CHECK(boost::hof::rotate(derived())(nullptr, 2) == 2);
36 BOOST_HOF_TEST_CHECK((2 | boost::hof::pipable(derived())(nullptr)) == 2);
37}
38

source code of boost/libs/hof/test/virtual_base.cpp