2
0
mirror of https://github.com/boostorg/hana.git synced 2026-02-14 12:52:10 +00:00
Files
hana/test/record.fold_move_only.cpp
2015-03-03 14:16:50 -05:00

36 lines
772 B
C++

/*
@copyright Louis Dionne 2015
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
*/
#include <boost/hana/foldable.hpp>
#include <boost/hana/record_macros.hpp>
#include <utility>
using namespace boost::hana;
struct moveonly {
moveonly() = default;
moveonly(moveonly const&) = delete;
moveonly(moveonly&&) = default;
};
struct T {
BOOST_HANA_DEFINE_RECORD_INTRUSIVE(T,
(moveonly, member1),
(moveonly, member2)
);
};
int f(int, moveonly) { return 1; }
int g(moveonly, int) { return 1; }
int main() {
// Folding a Record with move-only members should work when the
// Record is an rvalue.
foldl(T{}, 0, f);
foldr(T{}, 0, g);
}