• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*=============================================================================
2     Copyright (c) 2017 Paul Fultz II
3     placeholders.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/placeholders.hpp>
8 #include "test.hpp"
9 #include <sstream>
10 
11 // TODO: Test assign operators
12 
13 #if BOOST_HOF_HAS_STATIC_TEST_CHECK
14 #define BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR constexpr
15 #else
16 #define BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR
17 #endif
18 
19 struct square
20 {
21     template<class T>
22     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto operator()(T x) const BOOST_HOF_RETURNS(x*x);
23 };
24 
25 #define CHECK_DEFAULT_CONSTRUCTION_OP(op, name) \
26     static_assert(boost::hof::detail::is_default_constructible<boost::hof::operators::name>::value, "Operator not default constructible");
27 
28 #if BOOST_HOF_HAS_NOEXCEPT_DEDUCTION
29 #define PLACEHOLDER_CHECK(...) \
30     BOOST_HOF_STATIC_TEST_CHECK(__VA_ARGS__); \
31     BOOST_HOF_TEST_CHECK(__VA_ARGS__); \
32     static_assert(noexcept(__VA_ARGS__), "noexcept placeholders")
33 #else
34 #define PLACEHOLDER_CHECK(...) \
35     BOOST_HOF_STATIC_TEST_CHECK(__VA_ARGS__); \
36     BOOST_HOF_TEST_CHECK(__VA_ARGS__)
37 #endif
38 
BOOST_HOF_TEST_CASE()39 BOOST_HOF_TEST_CASE()
40 {
41     static_assert(boost::hof::detail::is_default_constructible<boost::hof::placeholder<1>>::value, "Placeholder not default constructible");
42     static_assert(boost::hof::detail::is_default_constructible<boost::hof::placeholder<2>>::value, "Placeholder not default constructible");
43     static_assert(boost::hof::detail::is_default_constructible<boost::hof::placeholder<3>>::value, "Placeholder not default constructible");
44 
45     BOOST_HOF_FOREACH_BINARY_OP(CHECK_DEFAULT_CONSTRUCTION_OP)
46     BOOST_HOF_FOREACH_ASSIGN_OP(CHECK_DEFAULT_CONSTRUCTION_OP)
47     BOOST_HOF_FOREACH_UNARY_OP(CHECK_DEFAULT_CONSTRUCTION_OP)
48 }
49 
BOOST_HOF_TEST_CASE()50 BOOST_HOF_TEST_CASE()
51 {
52     auto simple_print = boost::hof::reveal(std::ref(std::cout) << boost::hof::_);
53     simple_print("Hello");
54 }
55 
BOOST_HOF_TEST_CASE()56 BOOST_HOF_TEST_CASE()
57 {
58     std::stringstream ss;
59     auto simple_print = boost::hof::reveal(std::ref(ss) << boost::hof::_);
60     simple_print("Hello");
61     BOOST_HOF_TEST_CHECK(ss.str() == "Hello");
62 }
63 
BOOST_HOF_TEST_CASE()64 BOOST_HOF_TEST_CASE()
65 {
66     const auto x_square_add = 2 + (4*4);
67     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_square_add = boost::hof::_1 + boost::hof::lazy(square())(boost::hof::_2);
68 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
69     static_assert(std::is_copy_constructible<decltype(f_square_add)>::value, "Not copyable");
70 #endif
71     PLACEHOLDER_CHECK(f_square_add(2, 4) == x_square_add);
72 }
73 
BOOST_HOF_TEST_CASE()74 BOOST_HOF_TEST_CASE()
75 {
76     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_invoke_2 = boost::hof::_1(3);
77 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
78     static_assert(std::is_copy_constructible<decltype(f_invoke_2)>::value, "Not copyable");
79 #endif
80     PLACEHOLDER_CHECK(f_invoke_2(square()) == 9);
81 }
82 
BOOST_HOF_TEST_CASE()83 BOOST_HOF_TEST_CASE()
84 {
85     const auto x_add = 2 + 1;
86     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_add = boost::hof::_1 + boost::hof::_2;
87 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
88     static_assert(std::is_copy_constructible<decltype(f_add)>::value, "Not copyable");
89 #endif
90     static_assert(boost::hof::detail::is_default_constructible<decltype(f_add)>::value, "Not default constructible");
91     PLACEHOLDER_CHECK(f_add(2, 1) == x_add);
92 
93     const auto x_subtract = 2 - 1;
94     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_subtract = boost::hof::_1 - boost::hof::_2;
95 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
96     static_assert(std::is_copy_constructible<decltype(f_subtract)>::value, "Not copyable");
97 #endif
98     static_assert(boost::hof::detail::is_default_constructible<decltype(f_subtract)>::value, "Not default constructible");
99     PLACEHOLDER_CHECK(f_subtract(2, 1) == x_subtract);
100 
101     const auto x_multiply = 2 * 1;
102     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_multiply = boost::hof::_1 * boost::hof::_2;
103 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
104     static_assert(std::is_copy_constructible<decltype(f_multiply)>::value, "Not copyable");
105 #endif
106     static_assert(boost::hof::detail::is_default_constructible<decltype(f_multiply)>::value, "Not default constructible");
107     PLACEHOLDER_CHECK(f_multiply(2, 1) == x_multiply);
108 
109     const auto x_divide = 2 / 1;
110     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_divide = boost::hof::_1 / boost::hof::_2;
111 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
112     static_assert(std::is_copy_constructible<decltype(f_divide)>::value, "Not copyable");
113 #endif
114     static_assert(boost::hof::detail::is_default_constructible<decltype(f_divide)>::value, "Not default constructible");
115     PLACEHOLDER_CHECK(f_divide(2, 1) == x_divide);
116 
117     const auto x_remainder = 2 % 1;
118     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_remainder = boost::hof::_1 % boost::hof::_2;
119 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
120     static_assert(std::is_copy_constructible<decltype(f_remainder)>::value, "Not copyable");
121 #endif
122     static_assert(boost::hof::detail::is_default_constructible<decltype(f_remainder)>::value, "Not default constructible");
123     PLACEHOLDER_CHECK(f_remainder(2, 1) == x_remainder);
124 
125     const auto x_shift_right = 2 >> 1;
126     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_shift_right = boost::hof::_1 >> boost::hof::_2;
127 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
128     static_assert(std::is_copy_constructible<decltype(f_shift_right)>::value, "Not copyable");
129 #endif
130     static_assert(boost::hof::detail::is_default_constructible<decltype(f_shift_right)>::value, "Not default constructible");
131     PLACEHOLDER_CHECK(f_shift_right(2, 1) == x_shift_right);
132 
133     const auto x_shift_left = 2 << 1;
134     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_shift_left = boost::hof::_1 << boost::hof::_2;
135 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
136     static_assert(std::is_copy_constructible<decltype(f_shift_left)>::value, "Not copyable");
137 #endif
138     static_assert(boost::hof::detail::is_default_constructible<decltype(f_shift_left)>::value, "Not default constructible");
139     PLACEHOLDER_CHECK(f_shift_left(2, 1) == x_shift_left);
140 
141     const auto x_greater_than = 2 > 1;
142     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_greater_than = boost::hof::_1 > boost::hof::_2;
143 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
144     static_assert(std::is_copy_constructible<decltype(f_greater_than)>::value, "Not copyable");
145 #endif
146     static_assert(boost::hof::detail::is_default_constructible<decltype(f_greater_than)>::value, "Not default constructible");
147     PLACEHOLDER_CHECK(f_greater_than(2, 1) == x_greater_than);
148 
149     const auto x_less_than = 2 < 1;
150     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_less_than = boost::hof::_1 < boost::hof::_2;
151 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
152     static_assert(std::is_copy_constructible<decltype(f_less_than)>::value, "Not copyable");
153 #endif
154     static_assert(boost::hof::detail::is_default_constructible<decltype(f_less_than)>::value, "Not default constructible");
155     PLACEHOLDER_CHECK(f_less_than(2, 1) == x_less_than);
156 
157     const auto x_less_than_equal = 2 <= 1;
158     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_less_than_equal = boost::hof::_1 <= boost::hof::_2;
159 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
160     static_assert(std::is_copy_constructible<decltype(f_less_than_equal)>::value, "Not copyable");
161 #endif
162     static_assert(boost::hof::detail::is_default_constructible<decltype(f_less_than_equal)>::value, "Not default constructible");
163     PLACEHOLDER_CHECK(f_less_than_equal(2, 1) == x_less_than_equal);
164 
165     const auto x_greater_than_equal = 2 >= 1;
166     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_greater_than_equal = boost::hof::_1 >= boost::hof::_2;
167 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
168     static_assert(std::is_copy_constructible<decltype(f_greater_than_equal)>::value, "Not copyable");
169 #endif
170     static_assert(boost::hof::detail::is_default_constructible<decltype(f_greater_than_equal)>::value, "Not default constructible");
171     PLACEHOLDER_CHECK(f_greater_than_equal(2, 1) == x_greater_than_equal);
172 
173     const auto x_equal = 2 == 1;
174     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_equal = boost::hof::_1 == boost::hof::_2;
175 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
176     static_assert(std::is_copy_constructible<decltype(f_equal)>::value, "Not copyable");
177 #endif
178     static_assert(boost::hof::detail::is_default_constructible<decltype(f_equal)>::value, "Not default constructible");
179     PLACEHOLDER_CHECK(f_equal(2, 1) == x_equal);
180 
181     const auto x_not_equal = 2 != 1;
182     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_not_equal = boost::hof::_1 != boost::hof::_2;
183 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
184     static_assert(std::is_copy_constructible<decltype(f_not_equal)>::value, "Not copyable");
185 #endif
186     static_assert(boost::hof::detail::is_default_constructible<decltype(f_not_equal)>::value, "Not default constructible");
187     PLACEHOLDER_CHECK(f_not_equal(2, 1) == x_not_equal);
188 
189     const auto x_bit_and = 2 & 1;
190     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_bit_and = boost::hof::_1 & boost::hof::_2;
191 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
192     static_assert(std::is_copy_constructible<decltype(f_bit_and)>::value, "Not copyable");
193 #endif
194     static_assert(boost::hof::detail::is_default_constructible<decltype(f_bit_and)>::value, "Not default constructible");
195     PLACEHOLDER_CHECK(f_bit_and(2, 1) == x_bit_and);
196 
197     const auto x_xor_ = 2 ^ 1;
198     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_xor_ = boost::hof::_1 ^ boost::hof::_2;
199 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
200     static_assert(std::is_copy_constructible<decltype(f_xor_)>::value, "Not copyable");
201 #endif
202     static_assert(boost::hof::detail::is_default_constructible<decltype(f_xor_)>::value, "Not default constructible");
203     PLACEHOLDER_CHECK(f_xor_(2, 1) == x_xor_);
204 
205     const auto x_bit_or = 2 | 1;
206     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_bit_or = boost::hof::_1 | boost::hof::_2;
207 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
208     static_assert(std::is_copy_constructible<decltype(f_bit_or)>::value, "Not copyable");
209 #endif
210     static_assert(boost::hof::detail::is_default_constructible<decltype(f_bit_or)>::value, "Not default constructible");
211     PLACEHOLDER_CHECK(f_bit_or(2, 1) == x_bit_or);
212 
213     const auto x_and_ = true && false;
214     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_and_ = boost::hof::_1 && boost::hof::_2;
215 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
216     static_assert(std::is_copy_constructible<decltype(f_and_)>::value, "Not copyable");
217 #endif
218     static_assert(boost::hof::detail::is_default_constructible<decltype(f_and_)>::value, "Not default constructible");
219     PLACEHOLDER_CHECK(f_and_(true, false) == x_and_);
220 
221     const auto x_or_ = true;
222     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_or_ = boost::hof::_1 || boost::hof::_2;
223 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
224     static_assert(std::is_copy_constructible<decltype(f_or_)>::value, "Not copyable");
225 #endif
226     static_assert(boost::hof::detail::is_default_constructible<decltype(f_or_)>::value, "Not default constructible");
227     PLACEHOLDER_CHECK(f_or_(true, false) == x_or_);
228 }
229 
BOOST_HOF_TEST_CASE()230 BOOST_HOF_TEST_CASE()
231 {
232 
233     const auto x_not_ = !false;
234     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_not_ = !boost::hof::_1;
235 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
236     static_assert(std::is_copy_constructible<decltype(f_not_)>::value, "Not copyable");
237 #endif
238     static_assert(boost::hof::detail::is_default_constructible<decltype(f_not_)>::value, "Not default constructible");
239     PLACEHOLDER_CHECK(f_not_(false) == x_not_);
240 
241     const auto x_not_0 = !0;
242     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_not_0 = !boost::hof::_1;
243 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
244     static_assert(std::is_copy_constructible<decltype(f_not_0)>::value, "Not copyable");
245 #endif
246     static_assert(boost::hof::detail::is_default_constructible<decltype(f_not_0)>::value, "Not default constructible");
247     PLACEHOLDER_CHECK(f_not_0(0) == x_not_0);
248 
249     const auto x_compl_ = ~2;
250     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_compl_ = ~boost::hof::_1;
251 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
252     static_assert(std::is_copy_constructible<decltype(f_compl_)>::value, "Not copyable");
253 #endif
254     static_assert(boost::hof::detail::is_default_constructible<decltype(f_compl_)>::value, "Not default constructible");
255     PLACEHOLDER_CHECK(f_compl_(2) == x_compl_);
256 
257     const auto x_unary_plus = +2;
258     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_unary_plus = +boost::hof::_1;
259 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
260     static_assert(std::is_copy_constructible<decltype(f_unary_plus)>::value, "Not copyable");
261 #endif
262     static_assert(boost::hof::detail::is_default_constructible<decltype(f_unary_plus)>::value, "Not default constructible");
263     PLACEHOLDER_CHECK(f_unary_plus(2) == x_unary_plus);
264 
265     const auto x_unary_subtract = -2;
266     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_unary_subtract = -boost::hof::_1;
267 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
268     static_assert(std::is_copy_constructible<decltype(f_unary_subtract)>::value, "Not copyable");
269 #endif
270     static_assert(boost::hof::detail::is_default_constructible<decltype(f_unary_subtract)>::value, "Not default constructible");
271     PLACEHOLDER_CHECK(f_unary_subtract(2) == x_unary_subtract);
272 
273     const auto x_dereference = 2;
274     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_dereference = *boost::hof::_1;
275 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
276     static_assert(std::is_copy_constructible<decltype(f_dereference)>::value, "Not copyable");
277 #endif
278     static_assert(boost::hof::detail::is_default_constructible<decltype(f_dereference)>::value, "Not default constructible");
279     PLACEHOLDER_CHECK(f_dereference(&x_dereference) == x_dereference);
280 
281     // TODO: Test BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR increment and decrement
282 #ifndef _MSC_VER
283     auto x_increment = 2;
284     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_increment = ++boost::hof::_1;
285 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
286     static_assert(std::is_copy_constructible<decltype(f_increment)>::value, "Not copyable");
287 #endif
288     static_assert(boost::hof::detail::is_default_constructible<decltype(f_increment)>::value, "Not default constructible");
289     f_increment(x_increment);
290     BOOST_HOF_TEST_CHECK(x_increment == 3);
291 
292     auto x_decrement = 2;
293     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_decrement = --boost::hof::_1;
294 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
295     static_assert(std::is_copy_constructible<decltype(f_decrement)>::value, "Not copyable");
296 #endif
297     static_assert(boost::hof::detail::is_default_constructible<decltype(f_decrement)>::value, "Not default constructible");
298     f_decrement(x_decrement);
299     BOOST_HOF_TEST_CHECK(x_decrement == 1);
300 #endif
301 
302     // TODO: Test post increment and decrement
303 }
304 
305 
BOOST_HOF_TEST_CASE()306 BOOST_HOF_TEST_CASE()
307 {
308     const auto x_add = 2 + 1;
309     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_add = boost::hof::_ + boost::hof::_;
310 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
311     static_assert(std::is_copy_constructible<decltype(f_add)>::value, "Not copyable");
312 #endif
313     static_assert(boost::hof::detail::is_default_constructible<decltype(f_add)>::value, "Not default constructible");
314     PLACEHOLDER_CHECK(f_add(2, 1) == x_add);
315 
316     const auto x_subtract = 2 - 1;
317     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_subtract = boost::hof::_ - boost::hof::_;
318 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
319     static_assert(std::is_copy_constructible<decltype(f_subtract)>::value, "Not copyable");
320 #endif
321     static_assert(boost::hof::detail::is_default_constructible<decltype(f_subtract)>::value, "Not default constructible");
322     PLACEHOLDER_CHECK(f_subtract(2, 1) == x_subtract);
323 
324     const auto x_multiply = 2 * 1;
325     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_multiply = boost::hof::_ * boost::hof::_;
326 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
327     static_assert(std::is_copy_constructible<decltype(f_multiply)>::value, "Not copyable");
328 #endif
329     static_assert(boost::hof::detail::is_default_constructible<decltype(f_multiply)>::value, "Not default constructible");
330     PLACEHOLDER_CHECK(f_multiply(2, 1) == x_multiply);
331 
332     const auto x_divide = 2 / 1;
333     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_divide = boost::hof::_ / boost::hof::_;
334 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
335     static_assert(std::is_copy_constructible<decltype(f_divide)>::value, "Not copyable");
336 #endif
337     static_assert(boost::hof::detail::is_default_constructible<decltype(f_divide)>::value, "Not default constructible");
338     PLACEHOLDER_CHECK(f_divide(2, 1) == x_divide);
339 
340     const auto x_remainder = 2 % 1;
341     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_remainder = boost::hof::_ % boost::hof::_;
342 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
343     static_assert(std::is_copy_constructible<decltype(f_remainder)>::value, "Not copyable");
344 #endif
345     static_assert(boost::hof::detail::is_default_constructible<decltype(f_remainder)>::value, "Not default constructible");
346     PLACEHOLDER_CHECK(f_remainder(2, 1) == x_remainder);
347 
348     const auto x_shift_right = 2 >> 1;
349     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_shift_right = boost::hof::_ >> boost::hof::_;
350 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
351     static_assert(std::is_copy_constructible<decltype(f_shift_right)>::value, "Not copyable");
352 #endif
353     static_assert(boost::hof::detail::is_default_constructible<decltype(f_shift_right)>::value, "Not default constructible");
354     PLACEHOLDER_CHECK(f_shift_right(2, 1) == x_shift_right);
355 
356     const auto x_shift_left = 2 << 1;
357     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_shift_left = boost::hof::_ << boost::hof::_;
358 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
359     static_assert(std::is_copy_constructible<decltype(f_shift_left)>::value, "Not copyable");
360 #endif
361     static_assert(boost::hof::detail::is_default_constructible<decltype(f_shift_left)>::value, "Not default constructible");
362     PLACEHOLDER_CHECK(f_shift_left(2, 1) == x_shift_left);
363 
364     const auto x_greater_than = 2 > 1;
365     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_greater_than = boost::hof::_ > boost::hof::_;
366 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
367     static_assert(std::is_copy_constructible<decltype(f_greater_than)>::value, "Not copyable");
368 #endif
369     static_assert(boost::hof::detail::is_default_constructible<decltype(f_greater_than)>::value, "Not default constructible");
370     PLACEHOLDER_CHECK(f_greater_than(2, 1) == x_greater_than);
371 
372     const auto x_less_than = 2 < 1;
373     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_less_than = boost::hof::_ < boost::hof::_;
374 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
375     static_assert(std::is_copy_constructible<decltype(f_less_than)>::value, "Not copyable");
376 #endif
377     static_assert(boost::hof::detail::is_default_constructible<decltype(f_less_than)>::value, "Not default constructible");
378     PLACEHOLDER_CHECK(f_less_than(2, 1) == x_less_than);
379 
380     const auto x_less_than_equal = 2 <= 1;
381     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_less_than_equal = boost::hof::_ <= boost::hof::_;
382 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
383     static_assert(std::is_copy_constructible<decltype(f_less_than_equal)>::value, "Not copyable");
384 #endif
385     static_assert(boost::hof::detail::is_default_constructible<decltype(f_less_than_equal)>::value, "Not default constructible");
386     PLACEHOLDER_CHECK(f_less_than_equal(2, 1) == x_less_than_equal);
387 
388     const auto x_greater_than_equal = 2 >= 1;
389     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_greater_than_equal = boost::hof::_ >= boost::hof::_;
390 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
391     static_assert(std::is_copy_constructible<decltype(f_greater_than_equal)>::value, "Not copyable");
392 #endif
393     static_assert(boost::hof::detail::is_default_constructible<decltype(f_greater_than_equal)>::value, "Not default constructible");
394     PLACEHOLDER_CHECK(f_greater_than_equal(2, 1) == x_greater_than_equal);
395 
396     const auto x_equal = 2 == 1;
397     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_equal = boost::hof::_ == boost::hof::_;
398 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
399     static_assert(std::is_copy_constructible<decltype(f_equal)>::value, "Not copyable");
400 #endif
401     static_assert(boost::hof::detail::is_default_constructible<decltype(f_equal)>::value, "Not default constructible");
402     PLACEHOLDER_CHECK(f_equal(2, 1) == x_equal);
403 
404     const auto x_not_equal = 2 != 1;
405     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_not_equal = boost::hof::_ != boost::hof::_;
406 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
407     static_assert(std::is_copy_constructible<decltype(f_not_equal)>::value, "Not copyable");
408 #endif
409     static_assert(boost::hof::detail::is_default_constructible<decltype(f_not_equal)>::value, "Not default constructible");
410     PLACEHOLDER_CHECK(f_not_equal(2, 1) == x_not_equal);
411 
412     const auto x_bit_and = 2 & 1;
413     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_bit_and = boost::hof::_ & boost::hof::_;
414 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
415     static_assert(std::is_copy_constructible<decltype(f_bit_and)>::value, "Not copyable");
416 #endif
417     static_assert(boost::hof::detail::is_default_constructible<decltype(f_bit_and)>::value, "Not default constructible");
418     PLACEHOLDER_CHECK(f_bit_and(2, 1) == x_bit_and);
419 
420     const auto x_xor_ = 2 ^ 1;
421     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_xor_ = boost::hof::_ ^ boost::hof::_;
422 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
423     static_assert(std::is_copy_constructible<decltype(f_xor_)>::value, "Not copyable");
424 #endif
425     static_assert(boost::hof::detail::is_default_constructible<decltype(f_xor_)>::value, "Not default constructible");
426     PLACEHOLDER_CHECK(f_xor_(2, 1) == x_xor_);
427 
428     const auto x_bit_or = 2 | 1;
429     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_bit_or = boost::hof::_ | boost::hof::_;
430 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
431     static_assert(std::is_copy_constructible<decltype(f_bit_or)>::value, "Not copyable");
432 #endif
433     static_assert(boost::hof::detail::is_default_constructible<decltype(f_bit_or)>::value, "Not default constructible");
434     PLACEHOLDER_CHECK(f_bit_or(2, 1) == x_bit_or);
435 
436     const auto x_and_ = true && false;
437     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_and_ = boost::hof::_ && boost::hof::_;
438 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
439     static_assert(std::is_copy_constructible<decltype(f_and_)>::value, "Not copyable");
440 #endif
441     static_assert(boost::hof::detail::is_default_constructible<decltype(f_and_)>::value, "Not default constructible");
442     PLACEHOLDER_CHECK(f_and_(true, false) == x_and_);
443 
444     const auto x_or_ = true;
445     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_or_ = boost::hof::_ || boost::hof::_;
446 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
447     static_assert(std::is_copy_constructible<decltype(f_or_)>::value, "Not copyable");
448 #endif
449     static_assert(boost::hof::detail::is_default_constructible<decltype(f_or_)>::value, "Not default constructible");
450     PLACEHOLDER_CHECK(f_or_(true, false) == x_or_);
451 }
452 
BOOST_HOF_TEST_CASE()453 BOOST_HOF_TEST_CASE()
454 {
455     const auto x_add = 2 + 1;
456     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_add = 2 + boost::hof::_;
457 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
458     static_assert(std::is_copy_constructible<decltype(f_add)>::value, "Not copyable");
459 #endif
460     static_assert(!boost::hof::detail::is_default_constructible<decltype(f_add)>::value, "default constructible");
461     PLACEHOLDER_CHECK(f_add(1) == x_add);
462 
463     const auto x_subtract = 2 - 1;
464     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_subtract = 2 - boost::hof::_;
465 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
466     static_assert(std::is_copy_constructible<decltype(f_subtract)>::value, "Not copyable");
467 #endif
468     static_assert(!boost::hof::detail::is_default_constructible<decltype(f_subtract)>::value, "default constructible");
469     PLACEHOLDER_CHECK(f_subtract(1) == x_subtract);
470 
471     const auto x_multiply = 2 * 1;
472     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_multiply = 2 * boost::hof::_;
473 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
474     static_assert(std::is_copy_constructible<decltype(f_multiply)>::value, "Not copyable");
475 #endif
476     static_assert(!boost::hof::detail::is_default_constructible<decltype(f_multiply)>::value, "default constructible");
477     PLACEHOLDER_CHECK(f_multiply(1) == x_multiply);
478 
479     const auto x_divide = 2 / 1;
480     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_divide = 2 / boost::hof::_;
481 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
482     static_assert(std::is_copy_constructible<decltype(f_divide)>::value, "Not copyable");
483 #endif
484     static_assert(!boost::hof::detail::is_default_constructible<decltype(f_divide)>::value, "default constructible");
485     PLACEHOLDER_CHECK(f_divide(1) == x_divide);
486 
487     const auto x_remainder = 2 % 1;
488     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_remainder = 2 % boost::hof::_;
489 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
490     static_assert(std::is_copy_constructible<decltype(f_remainder)>::value, "Not copyable");
491 #endif
492     static_assert(!boost::hof::detail::is_default_constructible<decltype(f_remainder)>::value, "default constructible");
493     PLACEHOLDER_CHECK(f_remainder(1) == x_remainder);
494 
495     const auto x_shift_right = 2 >> 1;
496     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_shift_right = 2 >> boost::hof::_;
497 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
498     static_assert(std::is_copy_constructible<decltype(f_shift_right)>::value, "Not copyable");
499 #endif
500     static_assert(!boost::hof::detail::is_default_constructible<decltype(f_shift_right)>::value, "default constructible");
501     PLACEHOLDER_CHECK(f_shift_right(1) == x_shift_right);
502 
503     const auto x_shift_left = 2 << 1;
504     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_shift_left = 2 << boost::hof::_;
505 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
506     static_assert(std::is_copy_constructible<decltype(f_shift_left)>::value, "Not copyable");
507 #endif
508     static_assert(!boost::hof::detail::is_default_constructible<decltype(f_shift_left)>::value, "default constructible");
509     PLACEHOLDER_CHECK(f_shift_left(1) == x_shift_left);
510 
511     const auto x_greater_than = 2 > 1;
512     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_greater_than = 2 > boost::hof::_;
513 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
514     static_assert(std::is_copy_constructible<decltype(f_greater_than)>::value, "Not copyable");
515 #endif
516     static_assert(!boost::hof::detail::is_default_constructible<decltype(f_greater_than)>::value, "default constructible");
517     PLACEHOLDER_CHECK(f_greater_than(1) == x_greater_than);
518 
519     const auto x_less_than = 2 < 1;
520     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_less_than = 2 < boost::hof::_;
521 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
522     static_assert(std::is_copy_constructible<decltype(f_less_than)>::value, "Not copyable");
523 #endif
524     static_assert(!boost::hof::detail::is_default_constructible<decltype(f_less_than)>::value, "default constructible");
525     PLACEHOLDER_CHECK(f_less_than(1) == x_less_than);
526 
527     const auto x_less_than_equal = 2 <= 1;
528     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_less_than_equal = 2 <= boost::hof::_;
529 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
530     static_assert(std::is_copy_constructible<decltype(f_less_than_equal)>::value, "Not copyable");
531 #endif
532     static_assert(!boost::hof::detail::is_default_constructible<decltype(f_less_than_equal)>::value, "default constructible");
533     PLACEHOLDER_CHECK(f_less_than_equal(1) == x_less_than_equal);
534 
535     const auto x_greater_than_equal = 2 >= 1;
536     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_greater_than_equal = 2 >= boost::hof::_;
537 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
538     static_assert(std::is_copy_constructible<decltype(f_greater_than_equal)>::value, "Not copyable");
539 #endif
540     static_assert(!boost::hof::detail::is_default_constructible<decltype(f_greater_than_equal)>::value, "default constructible");
541     PLACEHOLDER_CHECK(f_greater_than_equal(1) == x_greater_than_equal);
542 
543     const auto x_equal = 2 == 1;
544     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_equal = 2 == boost::hof::_;
545 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
546     static_assert(std::is_copy_constructible<decltype(f_equal)>::value, "Not copyable");
547 #endif
548     static_assert(!boost::hof::detail::is_default_constructible<decltype(f_equal)>::value, "default constructible");
549     PLACEHOLDER_CHECK(f_equal(1) == x_equal);
550 
551     const auto x_not_equal = 2 != 1;
552     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_not_equal = 2 != boost::hof::_;
553 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
554     static_assert(std::is_copy_constructible<decltype(f_not_equal)>::value, "Not copyable");
555 #endif
556     static_assert(!boost::hof::detail::is_default_constructible<decltype(f_not_equal)>::value, "default constructible");
557     PLACEHOLDER_CHECK(f_not_equal(1) == x_not_equal);
558 
559     const auto x_bit_and = 2 & 1;
560     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_bit_and = 2 & boost::hof::_;
561 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
562     static_assert(std::is_copy_constructible<decltype(f_bit_and)>::value, "Not copyable");
563 #endif
564     static_assert(!boost::hof::detail::is_default_constructible<decltype(f_bit_and)>::value, "default constructible");
565     PLACEHOLDER_CHECK(f_bit_and(1) == x_bit_and);
566 
567     const auto x_xor_ = 2 ^ 1;
568     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_xor_ = 2 ^ boost::hof::_;
569 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
570     static_assert(std::is_copy_constructible<decltype(f_xor_)>::value, "Not copyable");
571 #endif
572     static_assert(!boost::hof::detail::is_default_constructible<decltype(f_xor_)>::value, "default constructible");
573     PLACEHOLDER_CHECK(f_xor_(1) == x_xor_);
574 
575     const auto x_bit_or = 2 | 1;
576     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_bit_or = 2 | boost::hof::_;
577 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
578     static_assert(std::is_copy_constructible<decltype(f_bit_or)>::value, "Not copyable");
579 #endif
580     static_assert(!boost::hof::detail::is_default_constructible<decltype(f_bit_or)>::value, "default constructible");
581     PLACEHOLDER_CHECK(f_bit_or(1) == x_bit_or);
582 
583     const auto x_and_ = true && false;
584     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_and_ = true && boost::hof::_;
585 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
586     static_assert(std::is_copy_constructible<decltype(f_and_)>::value, "Not copyable");
587 #endif
588     static_assert(!boost::hof::detail::is_default_constructible<decltype(f_and_)>::value, "default constructible");
589     PLACEHOLDER_CHECK(f_and_(false) == x_and_);
590 
591     const auto x_or_ = true;
592     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_or_ = true || boost::hof::_;
593 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
594     static_assert(std::is_copy_constructible<decltype(f_or_)>::value, "Not copyable");
595 #endif
596     static_assert(!boost::hof::detail::is_default_constructible<decltype(f_or_)>::value, "default constructible");
597     PLACEHOLDER_CHECK(f_or_(false) == x_or_);
598 }
599 
BOOST_HOF_TEST_CASE()600 BOOST_HOF_TEST_CASE()
601 {
602     const auto x_add = 2 + 1;
603     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_add = boost::hof::_ + 1;
604 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
605     static_assert(std::is_copy_constructible<decltype(f_add)>::value, "Not copyable");
606 #endif
607     static_assert(!boost::hof::detail::is_default_constructible<decltype(f_add)>::value, "default constructible");
608     PLACEHOLDER_CHECK(f_add(2) == x_add);
609 
610     const auto x_subtract = 2 - 1;
611     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_subtract = boost::hof::_ - 1;
612 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
613     static_assert(std::is_copy_constructible<decltype(f_subtract)>::value, "Not copyable");
614 #endif
615     static_assert(!boost::hof::detail::is_default_constructible<decltype(f_subtract)>::value, "default constructible");
616     PLACEHOLDER_CHECK(f_subtract(2) == x_subtract);
617 
618     const auto x_multiply = 2 * 1;
619     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_multiply = boost::hof::_ * 1;
620 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
621     static_assert(std::is_copy_constructible<decltype(f_multiply)>::value, "Not copyable");
622 #endif
623     static_assert(!boost::hof::detail::is_default_constructible<decltype(f_multiply)>::value, "default constructible");
624     PLACEHOLDER_CHECK(f_multiply(2) == x_multiply);
625 
626     const auto x_divide = 2 / 1;
627     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_divide = boost::hof::_ / 1;
628 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
629     static_assert(std::is_copy_constructible<decltype(f_divide)>::value, "Not copyable");
630 #endif
631     static_assert(!boost::hof::detail::is_default_constructible<decltype(f_divide)>::value, "default constructible");
632     PLACEHOLDER_CHECK(f_divide(2) == x_divide);
633 
634     const auto x_remainder = 2 % 1;
635     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_remainder = boost::hof::_ % 1;
636 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
637     static_assert(std::is_copy_constructible<decltype(f_remainder)>::value, "Not copyable");
638 #endif
639     static_assert(!boost::hof::detail::is_default_constructible<decltype(f_remainder)>::value, "default constructible");
640     PLACEHOLDER_CHECK(f_remainder(2) == x_remainder);
641 
642     const auto x_shift_right = 2 >> 1;
643     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_shift_right = boost::hof::_ >> 1;
644 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
645     static_assert(std::is_copy_constructible<decltype(f_shift_right)>::value, "Not copyable");
646 #endif
647     static_assert(!boost::hof::detail::is_default_constructible<decltype(f_shift_right)>::value, "default constructible");
648     PLACEHOLDER_CHECK(f_shift_right(2) == x_shift_right);
649 
650     const auto x_shift_left = 2 << 1;
651     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_shift_left = boost::hof::_ << 1;
652 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
653     static_assert(std::is_copy_constructible<decltype(f_shift_left)>::value, "Not copyable");
654 #endif
655     static_assert(!boost::hof::detail::is_default_constructible<decltype(f_shift_left)>::value, "default constructible");
656     PLACEHOLDER_CHECK(f_shift_left(2) == x_shift_left);
657 
658     const auto x_greater_than = 2 > 1;
659     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_greater_than = boost::hof::_ > 1;
660 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
661     static_assert(std::is_copy_constructible<decltype(f_greater_than)>::value, "Not copyable");
662 #endif
663     static_assert(!boost::hof::detail::is_default_constructible<decltype(f_greater_than)>::value, "default constructible");
664     PLACEHOLDER_CHECK(f_greater_than(2) == x_greater_than);
665 
666     const auto x_less_than = 2 < 1;
667     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_less_than = boost::hof::_ < 1;
668 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
669     static_assert(std::is_copy_constructible<decltype(f_less_than)>::value, "Not copyable");
670 #endif
671     static_assert(!boost::hof::detail::is_default_constructible<decltype(f_less_than)>::value, "default constructible");
672     PLACEHOLDER_CHECK(f_less_than(2) == x_less_than);
673 
674     const auto x_less_than_equal = 2 <= 1;
675     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_less_than_equal = boost::hof::_ <= 1;
676 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
677     static_assert(std::is_copy_constructible<decltype(f_less_than_equal)>::value, "Not copyable");
678 #endif
679     static_assert(!boost::hof::detail::is_default_constructible<decltype(f_less_than_equal)>::value, "default constructible");
680     PLACEHOLDER_CHECK(f_less_than_equal(2) == x_less_than_equal);
681 
682     const auto x_greater_than_equal = 2 >= 1;
683     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_greater_than_equal = boost::hof::_ >= 1;
684 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
685     static_assert(std::is_copy_constructible<decltype(f_greater_than_equal)>::value, "Not copyable");
686 #endif
687     static_assert(!boost::hof::detail::is_default_constructible<decltype(f_greater_than_equal)>::value, "default constructible");
688     PLACEHOLDER_CHECK(f_greater_than_equal(2) == x_greater_than_equal);
689 
690     const auto x_equal = 2 == 1;
691     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_equal = boost::hof::_ == 1;
692 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
693     static_assert(std::is_copy_constructible<decltype(f_equal)>::value, "Not copyable");
694 #endif
695     static_assert(!boost::hof::detail::is_default_constructible<decltype(f_equal)>::value, "default constructible");
696     PLACEHOLDER_CHECK(f_equal(2) == x_equal);
697 
698     const auto x_not_equal = 2 != 1;
699     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_not_equal = boost::hof::_ != 1;
700 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
701     static_assert(std::is_copy_constructible<decltype(f_not_equal)>::value, "Not copyable");
702 #endif
703     static_assert(!boost::hof::detail::is_default_constructible<decltype(f_not_equal)>::value, "default constructible");
704     PLACEHOLDER_CHECK(f_not_equal(2) == x_not_equal);
705 
706     const auto x_bit_and = 2 & 1;
707     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_bit_and = boost::hof::_ & 1;
708 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
709     static_assert(std::is_copy_constructible<decltype(f_bit_and)>::value, "Not copyable");
710 #endif
711     static_assert(!boost::hof::detail::is_default_constructible<decltype(f_bit_and)>::value, "default constructible");
712     PLACEHOLDER_CHECK(f_bit_and(2) == x_bit_and);
713 
714     const auto x_xor_ = 2 ^ 1;
715     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_xor_ = boost::hof::_ ^ 1;
716 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
717     static_assert(std::is_copy_constructible<decltype(f_xor_)>::value, "Not copyable");
718 #endif
719     static_assert(!boost::hof::detail::is_default_constructible<decltype(f_xor_)>::value, "default constructible");
720     PLACEHOLDER_CHECK(f_xor_(2) == x_xor_);
721 
722     const auto x_bit_or = 2 | 1;
723     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_bit_or = boost::hof::_ | 1;
724 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
725     static_assert(std::is_copy_constructible<decltype(f_bit_or)>::value, "Not copyable");
726 #endif
727     static_assert(!boost::hof::detail::is_default_constructible<decltype(f_bit_or)>::value, "default constructible");
728     PLACEHOLDER_CHECK(f_bit_or(2) == x_bit_or);
729 
730     const auto x_and_ = true && false;
731     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_and_ = boost::hof::_ && false;
732 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
733     static_assert(std::is_copy_constructible<decltype(f_and_)>::value, "Not copyable");
734 #endif
735     static_assert(!boost::hof::detail::is_default_constructible<decltype(f_and_)>::value, "default constructible");
736     PLACEHOLDER_CHECK(f_and_(true) == x_and_);
737 
738     const auto x_or_ = true;
739     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_or_ = boost::hof::_ || false;
740 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
741     static_assert(std::is_copy_constructible<decltype(f_or_)>::value, "Not copyable");
742 #endif
743     static_assert(!boost::hof::detail::is_default_constructible<decltype(f_or_)>::value, "default constructible");
744     PLACEHOLDER_CHECK(f_or_(true) == x_or_);
745 }
746 
BOOST_HOF_TEST_CASE()747 BOOST_HOF_TEST_CASE()
748 {
749 
750     const auto x_not_ = !false;
751     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_not_ = !boost::hof::_;
752 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
753     static_assert(std::is_copy_constructible<decltype(f_not_)>::value, "Not copyable");
754 #endif
755     static_assert(boost::hof::detail::is_default_constructible<decltype(f_not_)>::value, "Not default constructible");
756     PLACEHOLDER_CHECK(f_not_(false) == x_not_);
757 
758     const auto x_compl_ = ~2;
759     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_compl_ = ~boost::hof::_;
760 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
761     static_assert(std::is_copy_constructible<decltype(f_compl_)>::value, "Not copyable");
762 #endif
763     static_assert(boost::hof::detail::is_default_constructible<decltype(f_compl_)>::value, "Not default constructible");
764     PLACEHOLDER_CHECK(f_compl_(2) == x_compl_);
765 
766     const auto x_unary_plus = +2;
767     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_unary_plus = +boost::hof::_;
768 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
769     static_assert(std::is_copy_constructible<decltype(f_unary_plus)>::value, "Not copyable");
770 #endif
771     static_assert(boost::hof::detail::is_default_constructible<decltype(f_unary_plus)>::value, "Not default constructible");
772     PLACEHOLDER_CHECK(f_unary_plus(2) == x_unary_plus);
773 
774     const auto x_unary_subtract = -2;
775     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_unary_subtract = -boost::hof::_;
776 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
777     static_assert(std::is_copy_constructible<decltype(f_unary_subtract)>::value, "Not copyable");
778 #endif
779     static_assert(boost::hof::detail::is_default_constructible<decltype(f_unary_subtract)>::value, "Not default constructible");
780     PLACEHOLDER_CHECK(f_unary_subtract(2) == x_unary_subtract);
781 
782     const auto x_dereference = 2;
783     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_dereference = *boost::hof::_;
784 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
785     static_assert(std::is_copy_constructible<decltype(f_dereference)>::value, "Not copyable");
786 #endif
787     static_assert(boost::hof::detail::is_default_constructible<decltype(f_dereference)>::value, "Not default constructible");
788     PLACEHOLDER_CHECK(f_dereference(&x_dereference) == x_dereference);
789 
790     // TODO: Test constexpr increment and decrement
791 #ifndef _MSC_VER
792     auto x_increment = 2;
793     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_increment = ++boost::hof::_;
794 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
795     static_assert(std::is_copy_constructible<decltype(f_increment)>::value, "Not copyable");
796 #endif
797     static_assert(boost::hof::detail::is_default_constructible<decltype(f_increment)>::value, "Not default constructible");
798     f_increment(x_increment);
799     BOOST_HOF_TEST_CHECK(x_increment == 3);
800 
801     auto x_decrement = 2;
802     BOOST_HOF_PLACEHOLDER_TEST_CONSTEXPR auto f_decrement = --boost::hof::_;
803 #if defined(__GNUC__) && !defined (__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ > 6
804     static_assert(std::is_copy_constructible<decltype(f_decrement)>::value, "Not copyable");
805 #endif
806     static_assert(boost::hof::detail::is_default_constructible<decltype(f_decrement)>::value, "Not default constructible");
807     f_decrement(x_decrement);
808     BOOST_HOF_TEST_CHECK(x_decrement == 1);
809 #endif
810 
811     // TODO: Test post increment and decrement
812 }
813 
814