diff --git a/boost/yap/config.hpp b/boost/yap/config.hpp
new file mode 100644
index 0000000..35f7000
--- /dev/null
+++ b/boost/yap/config.hpp
@@ -0,0 +1,18 @@
+#ifndef BOOST_YAP_CONFIG_HPP_INCLUDED
+#define BOOST_YAP_CONFIG_HPP_INCLUDED
+
+
+#ifndef BOOST_YAP_CONVERSION_OPERATOR_TEMPLATE
+/** Controls whether a conversion operator template is defined for
+ expression<>.
+
+ Default value is 0.
+
+ This is useful when you want to have expression<>s
+ auto-evaluated on assignment to non-yap types. It can also
+ wreak havok on your code due to unintentional implicit conversions. Here
+ be dragons. */
+#define BOOST_YAP_CONVERSION_OPERATOR_TEMPLATE 0
+#endif
+
+#endif
diff --git a/boost/yap/expression.hpp b/boost/yap/expression.hpp
index 2a74d82..8ad3f20 100644
--- a/boost/yap/expression.hpp
+++ b/boost/yap/expression.hpp
@@ -126,13 +126,13 @@ namespace boost { namespace yap {
tuple_type elements;
-#if defined(BOOST_YAP_CONVERSION_OPERATOR_TEMPLATE) || defined(BOOST_YAP_DOXYGEN)
+#if BOOST_YAP_CONVERSION_OPERATOR_TEMPLATE || defined(BOOST_YAP_DOXYGEN)
/** Conversion operator. Attempts to convert \c *this to any type \a
R with a call to the eval_expression_as()
customization point. This function is only defined if the
configuration macro
BOOST_YAP_CONVERSION_OPERATOR_TEMPLATE has been
- defined by the user. */ // TODO: customization points need documentation.
+ defined by the user to be nonzero. */ // TODO: customization points need documentation.
template
operator R ()
{ return eval_expression_as(*this, hana::basic_type{}); }
@@ -375,13 +375,13 @@ namespace boost { namespace yap {
tuple_type elements;
-#if defined(BOOST_YAP_CONVERSION_OPERATOR_TEMPLATE) || defined(BOOST_YAP_DOXYGEN)
+#if BOOST_YAP_CONVERSION_OPERATOR_TEMPLATE || defined(BOOST_YAP_DOXYGEN)
/** Conversion operator. Attempts to convert \c *this to any type \a
R with a call to the eval_expression_as()
cutomization point. This function is only defined if the
configuration macro
BOOST_YAP_CONVERSION_OPERATOR_TEMPLATE has been
- defined by the user. */ // TODO
+ defined by the user to be nonzero. */ // TODO
template
operator R ()
{ return eval_expression_as(*this, hana::basic_type{}); }
@@ -779,125 +779,6 @@ namespace boost { namespace yap {
}
}
-#ifdef BOOST_YAP_DOXYGEN
-
- /** Only defined when the configuration macro
- BOOST_YAP_NO_FREE_OPERATORS_FOR_EXPRESSION is not. \see
- BOOST_YAP_USER_FREE_BINARY_OPERATOR for full semantics. */
- template auto operator<< (T && lhs, Expr && rhs);
- /** Only defined when the configuration macro
- BOOST_YAP_NO_FREE_OPERATORS_FOR_EXPRESSION is not. \see
- BOOST_YAP_USER_FREE_BINARY_OPERATOR for full semantics. */
- template auto operator>> (T && lhs, Expr && rhs);
- /** Only defined when the configuration macro
- BOOST_YAP_NO_FREE_OPERATORS_FOR_EXPRESSION is not. \see
- BOOST_YAP_USER_FREE_BINARY_OPERATOR for full semantics. */
- template auto operator* (T && lhs, Expr && rhs);
- /** Only defined when the configuration macro
- BOOST_YAP_NO_FREE_OPERATORS_FOR_EXPRESSION is not. \see
- BOOST_YAP_USER_FREE_BINARY_OPERATOR for full semantics. */
- template auto operator/ (T && lhs, Expr && rhs);
- /** Only defined when the configuration macro
- BOOST_YAP_NO_FREE_OPERATORS_FOR_EXPRESSION is not. \see
- BOOST_YAP_USER_FREE_BINARY_OPERATOR for full semantics. */
- template auto operator% (T && lhs, Expr && rhs);
- /** Only defined when the configuration macro
- BOOST_YAP_NO_FREE_OPERATORS_FOR_EXPRESSION is not. \see
- BOOST_YAP_USER_FREE_BINARY_OPERATOR for full semantics. */
- template auto operator+ (T && lhs, Expr && rhs);
- /** Only defined when the configuration macro
- BOOST_YAP_NO_FREE_OPERATORS_FOR_EXPRESSION is not. \see
- BOOST_YAP_USER_FREE_BINARY_OPERATOR for full semantics. */
- template auto operator- (T && lhs, Expr && rhs);
- /** Only defined when the configuration macro
- BOOST_YAP_NO_FREE_OPERATORS_FOR_EXPRESSION is not. \see
- BOOST_YAP_USER_FREE_BINARY_OPERATOR for full semantics. */
- template auto operator< (T && lhs, Expr && rhs);
- /** Only defined when the configuration macro
- BOOST_YAP_NO_FREE_OPERATORS_FOR_EXPRESSION is not. \see
- BOOST_YAP_USER_FREE_BINARY_OPERATOR for full semantics. */
- template auto operator> (T && lhs, Expr && rhs);
- /** Only defined when the configuration macro
- BOOST_YAP_NO_FREE_OPERATORS_FOR_EXPRESSION is not. \see
- BOOST_YAP_USER_FREE_BINARY_OPERATOR for full semantics. */
- template auto operator<= (T && lhs, Expr && rhs);
- /** Only defined when the configuration macro
- BOOST_YAP_NO_FREE_OPERATORS_FOR_EXPRESSION is not. \see
- BOOST_YAP_USER_FREE_BINARY_OPERATOR for full semantics. */
- template auto operator>= (T && lhs, Expr && rhs);
- /** Only defined when the configuration macro
- BOOST_YAP_NO_FREE_OPERATORS_FOR_EXPRESSION is not. \see
- BOOST_YAP_USER_FREE_BINARY_OPERATOR for full semantics. */
- template auto operator== (T && lhs, Expr && rhs);
- /** Only defined when the configuration macro
- BOOST_YAP_NO_FREE_OPERATORS_FOR_EXPRESSION is not. \see
- BOOST_YAP_USER_FREE_BINARY_OPERATOR for full semantics. */
- template auto operator!= (T && lhs, Expr && rhs);
- /** Only defined when the configuration macro
- BOOST_YAP_NO_FREE_OPERATORS_FOR_EXPRESSION is not. \see
- BOOST_YAP_USER_FREE_BINARY_OPERATOR for full semantics. */
- template auto operator|| (T && lhs, Expr && rhs);
- /** Only defined when the configuration macro
- BOOST_YAP_NO_FREE_OPERATORS_FOR_EXPRESSION is not. \see
- BOOST_YAP_USER_FREE_BINARY_OPERATOR for full semantics. */
- template auto operator&& (T && lhs, Expr && rhs);
- /** Only defined when the configuration macro
- BOOST_YAP_NO_FREE_OPERATORS_FOR_EXPRESSION is not. \see
- BOOST_YAP_USER_FREE_BINARY_OPERATOR for full semantics. */
- template auto operator& (T && lhs, Expr && rhs);
- /** Only defined when the configuration macro
- BOOST_YAP_NO_FREE_OPERATORS_FOR_EXPRESSION is not. \see
- BOOST_YAP_USER_FREE_BINARY_OPERATOR for full semantics. */
- template auto operator| (T && lhs, Expr && rhs);
- /** Only defined when the configuration macro
- BOOST_YAP_NO_FREE_OPERATORS_FOR_EXPRESSION is not. \see
- BOOST_YAP_USER_FREE_BINARY_OPERATOR for full semantics. */
- template auto operator^ (T && lhs, Expr && rhs);
-
- /** Only defined when the configuration macro
- BOOST_YAP_NO_EXPR_IF_ELSE_FOR_EXPRESSION is not. \see
- BOOST_YAP_USER_EXPR_IF_ELSE for full semantics. */
- template
- auto if_else (Expr1 && expr1, Expr2 && expr2, Expr3 && expr3);
-
-#else
-
-#ifndef BOOST_YAP_NO_FREE_OPERATORS_FOR_EXPRESSION
-
-#define BOOST_YAP_BINARY_FREE_OPERATOR(op_name) \
- BOOST_YAP_USER_FREE_BINARY_OPERATOR(op_name, expression)
-
- BOOST_YAP_BINARY_FREE_OPERATOR(shift_left) // <<
- BOOST_YAP_BINARY_FREE_OPERATOR(shift_right) // >>
- BOOST_YAP_BINARY_FREE_OPERATOR(multiplies) // *
- BOOST_YAP_BINARY_FREE_OPERATOR(divides) // /
- BOOST_YAP_BINARY_FREE_OPERATOR(modulus) // %
- BOOST_YAP_BINARY_FREE_OPERATOR(plus) // +
- BOOST_YAP_BINARY_FREE_OPERATOR(minus) // -
- BOOST_YAP_BINARY_FREE_OPERATOR(less) // <
- BOOST_YAP_BINARY_FREE_OPERATOR(greater) // >
- BOOST_YAP_BINARY_FREE_OPERATOR(less_equal) // <=
- BOOST_YAP_BINARY_FREE_OPERATOR(greater_equal) // >=
- BOOST_YAP_BINARY_FREE_OPERATOR(equal_to) // ==
- BOOST_YAP_BINARY_FREE_OPERATOR(not_equal_to) // !=
- BOOST_YAP_BINARY_FREE_OPERATOR(logical_or) // ||
- BOOST_YAP_BINARY_FREE_OPERATOR(logical_and) // &&
- BOOST_YAP_BINARY_FREE_OPERATOR(bitwise_and) // &
- BOOST_YAP_BINARY_FREE_OPERATOR(bitwise_or) // |
- BOOST_YAP_BINARY_FREE_OPERATOR(bitwise_xor) // ^
-
-#undef BOOST_YAP_BINARY_FREE_OPERATOR
-
-#endif
-
-#ifndef BOOST_YAP_NO_EXPR_IF_ELSE_FOR_EXPRESSION
-
- BOOST_YAP_USER_EXPR_IF_ELSE(::boost::yap::expression)
-
-#endif
-
-#endif // BOOST_YAP_DOXYGEN
-
/** Makes a new expression instantiated from the expression template \a
ExprTemplate, of kind \a Kind, with the given values as its elements.
diff --git a/boost/yap/expression_free_operators.hpp b/boost/yap/expression_free_operators.hpp
new file mode 100644
index 0000000..d332c91
--- /dev/null
+++ b/boost/yap/expression_free_operators.hpp
@@ -0,0 +1,76 @@
+#ifndef BOOST_YAP_EXPRESSION_FREE_OPERATORS_HPP_INCLUDED
+#define BOOST_YAP_EXPRESSION_FREE_OPERATORS_HPP_INCLUDED
+
+
+namespace boost { namespace yap {
+
+#ifndef BOOST_YAP_DOXYGEN
+
+#define BOOST_YAP_BINARY_FREE_OPERATOR(op_name) \
+ BOOST_YAP_USER_FREE_BINARY_OPERATOR(op_name, expression)
+
+ BOOST_YAP_BINARY_FREE_OPERATOR(shift_left) // <<
+ BOOST_YAP_BINARY_FREE_OPERATOR(shift_right) // >>
+ BOOST_YAP_BINARY_FREE_OPERATOR(multiplies) // *
+ BOOST_YAP_BINARY_FREE_OPERATOR(divides) // /
+ BOOST_YAP_BINARY_FREE_OPERATOR(modulus) // %
+ BOOST_YAP_BINARY_FREE_OPERATOR(plus) // +
+ BOOST_YAP_BINARY_FREE_OPERATOR(minus) // -
+ BOOST_YAP_BINARY_FREE_OPERATOR(less) // <
+ BOOST_YAP_BINARY_FREE_OPERATOR(greater) // >
+ BOOST_YAP_BINARY_FREE_OPERATOR(less_equal) // <=
+ BOOST_YAP_BINARY_FREE_OPERATOR(greater_equal) // >=
+ BOOST_YAP_BINARY_FREE_OPERATOR(equal_to) // ==
+ BOOST_YAP_BINARY_FREE_OPERATOR(not_equal_to) // !=
+ BOOST_YAP_BINARY_FREE_OPERATOR(logical_or) // ||
+ BOOST_YAP_BINARY_FREE_OPERATOR(logical_and) // &&
+ BOOST_YAP_BINARY_FREE_OPERATOR(bitwise_and) // &
+ BOOST_YAP_BINARY_FREE_OPERATOR(bitwise_or) // |
+ BOOST_YAP_BINARY_FREE_OPERATOR(bitwise_xor) // ^
+
+#undef BOOST_YAP_BINARY_FREE_OPERATOR
+
+#else
+
+ /** \see BOOST_YAP_USER_FREE_BINARY_OPERATOR for full semantics. */
+ template auto operator<< (T && lhs, Expr && rhs);
+ /** \see BOOST_YAP_USER_FREE_BINARY_OPERATOR for full semantics. */
+ template auto operator>> (T && lhs, Expr && rhs);
+ /** \see BOOST_YAP_USER_FREE_BINARY_OPERATOR for full semantics. */
+ template auto operator* (T && lhs, Expr && rhs);
+ /** \see BOOST_YAP_USER_FREE_BINARY_OPERATOR for full semantics. */
+ template auto operator/ (T && lhs, Expr && rhs);
+ /** \see BOOST_YAP_USER_FREE_BINARY_OPERATOR for full semantics. */
+ template auto operator% (T && lhs, Expr && rhs);
+ /** \see BOOST_YAP_USER_FREE_BINARY_OPERATOR for full semantics. */
+ template auto operator+ (T && lhs, Expr && rhs);
+ /** \see BOOST_YAP_USER_FREE_BINARY_OPERATOR for full semantics. */
+ template auto operator- (T && lhs, Expr && rhs);
+ /** \see BOOST_YAP_USER_FREE_BINARY_OPERATOR for full semantics. */
+ template auto operator< (T && lhs, Expr && rhs);
+ /** \see BOOST_YAP_USER_FREE_BINARY_OPERATOR for full semantics. */
+ template auto operator> (T && lhs, Expr && rhs);
+ /** \see BOOST_YAP_USER_FREE_BINARY_OPERATOR for full semantics. */
+ template auto operator<= (T && lhs, Expr && rhs);
+ /** \see BOOST_YAP_USER_FREE_BINARY_OPERATOR for full semantics. */
+ template auto operator>= (T && lhs, Expr && rhs);
+ /** \see BOOST_YAP_USER_FREE_BINARY_OPERATOR for full semantics. */
+ template auto operator== (T && lhs, Expr && rhs);
+ /** \see BOOST_YAP_USER_FREE_BINARY_OPERATOR for full semantics. */
+ template auto operator!= (T && lhs, Expr && rhs);
+ /** \see BOOST_YAP_USER_FREE_BINARY_OPERATOR for full semantics. */
+ template auto operator|| (T && lhs, Expr && rhs);
+ /** \see BOOST_YAP_USER_FREE_BINARY_OPERATOR for full semantics. */
+ template auto operator&& (T && lhs, Expr && rhs);
+ /** \see BOOST_YAP_USER_FREE_BINARY_OPERATOR for full semantics. */
+ template auto operator& (T && lhs, Expr && rhs);
+ /** \see BOOST_YAP_USER_FREE_BINARY_OPERATOR for full semantics. */
+ template auto operator| (T && lhs, Expr && rhs);
+ /** \see BOOST_YAP_USER_FREE_BINARY_OPERATOR for full semantics. */
+ template auto operator^ (T && lhs, Expr && rhs);
+
+#endif // BOOST_YAP_DOXYGEN
+
+} }
+
+#endif
diff --git a/boost/yap/expression_fwd.hpp b/boost/yap/expression_fwd.hpp
index 06dddd2..8039959 100644
--- a/boost/yap/expression_fwd.hpp
+++ b/boost/yap/expression_fwd.hpp
@@ -1,6 +1,8 @@
#ifndef BOOST_YAP_EXPRESSION_FWD_HPP_INCLUDED
#define BOOST_YAP_EXPRESSION_FWD_HPP_INCLUDED
+#include
+
#include
#include
diff --git a/boost/yap/expression_if_else.hpp b/boost/yap/expression_if_else.hpp
new file mode 100644
index 0000000..9ad5898
--- /dev/null
+++ b/boost/yap/expression_if_else.hpp
@@ -0,0 +1,21 @@
+#ifndef BOOST_YAP_EXPRESSION_IF_ELSE_HPP_INCLUDED
+#define BOOST_YAP_EXPRESSION_IF_ELSE_HPP_INCLUDED
+
+
+namespace boost { namespace yap {
+
+#ifndef BOOST_YAP_DOXYGEN
+
+ BOOST_YAP_USER_EXPR_IF_ELSE(::boost::yap::expression)
+
+#else
+
+ /** \see BOOST_YAP_USER_EXPR_IF_ELSE for full semantics. */
+ template
+ auto if_else (Expr1 && expr1, Expr2 && expr2, Expr3 && expr3);
+
+#endif
+
+} }
+
+#endif
diff --git a/boost/yap/yap.hpp b/boost/yap/yap.hpp
new file mode 100644
index 0000000..2fb3c14
--- /dev/null
+++ b/boost/yap/yap.hpp
@@ -0,0 +1,10 @@
+#ifndef BOOST_YAP_YAP_HPP_INCLUDED
+#define BOOST_YAP_YAP_HPP_INCLUDED
+
+
+#include
+#include
+#include
+#include
+
+#endif
diff --git a/example/lazy_vector.cpp b/example/lazy_vector.cpp
index 77900ec..4982d3a 100644
--- a/example/lazy_vector.cpp
+++ b/example/lazy_vector.cpp
@@ -1,4 +1,4 @@
-#define BOOST_YAP_CONVERSION_OPERATOR_TEMPLATE
+#define BOOST_YAP_CONVERSION_OPERATOR_TEMPLATE 1
#include
#include
diff --git a/example/mixed.cpp b/example/mixed.cpp
index 7be0e8e..808312f 100644
--- a/example/mixed.cpp
+++ b/example/mixed.cpp
@@ -1,4 +1,4 @@
-#include
+#include
#include
#include
diff --git a/example/vec3.cpp b/example/vec3.cpp
index 392d62e..358afe2 100644
--- a/example/vec3.cpp
+++ b/example/vec3.cpp
@@ -1,4 +1,4 @@
-#include
+#include
#include
#include
diff --git a/example/vector.cpp b/example/vector.cpp
index 971c4d3..b672dfd 100644
--- a/example/vector.cpp
+++ b/example/vector.cpp
@@ -1,4 +1,4 @@
-#include
+#include
#include
#include
diff --git a/perf/code_gen_samples.cpp b/perf/code_gen_samples.cpp
index 3d0897c..5bf78cc 100644
--- a/perf/code_gen_samples.cpp
+++ b/perf/code_gen_samples.cpp
@@ -1,4 +1,4 @@
-#define BOOST_YAP_CONVERSION_OPERATOR_TEMPLATE
+#define BOOST_YAP_CONVERSION_OPERATOR_TEMPLATE 1
#include
diff --git a/test/call_expr_implicit.cpp b/test/call_expr_implicit.cpp
index 4146f1d..ac7249d 100644
--- a/test/call_expr_implicit.cpp
+++ b/test/call_expr_implicit.cpp
@@ -1,4 +1,4 @@
-#define BOOST_YAP_CONVERSION_OPERATOR_TEMPLATE
+#define BOOST_YAP_CONVERSION_OPERATOR_TEMPLATE 1
#include
#include
diff --git a/test/compile_x_plus_term.cpp b/test/compile_x_plus_term.cpp
index 08eb89c..345e939 100644
--- a/test/compile_x_plus_term.cpp
+++ b/test/compile_x_plus_term.cpp
@@ -1,4 +1,5 @@
#include
+#include
#include
diff --git a/test/default_eval.cpp b/test/default_eval.cpp
index ccb7fd4..e4178f5 100644
--- a/test/default_eval.cpp
+++ b/test/default_eval.cpp
@@ -1,4 +1,4 @@
-#define BOOST_YAP_CONVERSION_OPERATOR_TEMPLATE
+#define BOOST_YAP_CONVERSION_OPERATOR_TEMPLATE 1
#include
#include
diff --git a/test/depth_stress_test_left.cpp b/test/depth_stress_test_left.cpp
index c2860c2..fb0e3d3 100644
--- a/test/depth_stress_test_left.cpp
+++ b/test/depth_stress_test_left.cpp
@@ -1,4 +1,4 @@
-#define BOOST_YAP_CONVERSION_OPERATOR_TEMPLATE
+#define BOOST_YAP_CONVERSION_OPERATOR_TEMPLATE 1
#include
#include
diff --git a/test/depth_stress_test_right.cpp b/test/depth_stress_test_right.cpp
index 62e6019..3717311 100644
--- a/test/depth_stress_test_right.cpp
+++ b/test/depth_stress_test_right.cpp
@@ -1,4 +1,4 @@
-#define BOOST_YAP_CONVERSION_OPERATOR_TEMPLATE
+#define BOOST_YAP_CONVERSION_OPERATOR_TEMPLATE 1
#include
#include
diff --git a/test/lazy_vector_alloc_test.cpp b/test/lazy_vector_alloc_test.cpp
index 421d3dd..81884e9 100644
--- a/test/lazy_vector_alloc_test.cpp
+++ b/test/lazy_vector_alloc_test.cpp
@@ -1,4 +1,4 @@
-#define BOOST_YAP_CONVERSION_OPERATOR_TEMPLATE
+#define BOOST_YAP_CONVERSION_OPERATOR_TEMPLATE 1
#include
#include
diff --git a/test/reference_returns.cpp b/test/reference_returns.cpp
index 8228384..7a21f71 100644
--- a/test/reference_returns.cpp
+++ b/test/reference_returns.cpp
@@ -1,4 +1,4 @@
-#define BOOST_YAP_CONVERSION_OPERATOR_TEMPLATE
+#define BOOST_YAP_CONVERSION_OPERATOR_TEMPLATE 1
#include
#include
diff --git a/test/user_eval_expression_as.cpp b/test/user_eval_expression_as.cpp
index a0c4b1d..de2773f 100644
--- a/test/user_eval_expression_as.cpp
+++ b/test/user_eval_expression_as.cpp
@@ -1,4 +1,4 @@
-#define BOOST_YAP_CONVERSION_OPERATOR_TEMPLATE
+#define BOOST_YAP_CONVERSION_OPERATOR_TEMPLATE 1
#include
#include
diff --git a/test/user_expression_transform.cpp b/test/user_expression_transform.cpp
index df068cd..c4e2bcf 100644
--- a/test/user_expression_transform.cpp
+++ b/test/user_expression_transform.cpp
@@ -1,4 +1,4 @@
-#define BOOST_YAP_CONVERSION_OPERATOR_TEMPLATE
+#define BOOST_YAP_CONVERSION_OPERATOR_TEMPLATE 1
#include
#include
diff --git a/test/user_expression_transform_2.cpp b/test/user_expression_transform_2.cpp
index f79fb60..5d51e40 100644
--- a/test/user_expression_transform_2.cpp
+++ b/test/user_expression_transform_2.cpp
@@ -1,4 +1,4 @@
-#define BOOST_YAP_CONVERSION_OPERATOR_TEMPLATE
+#define BOOST_YAP_CONVERSION_OPERATOR_TEMPLATE 1
#include
#include
diff --git a/test/user_expression_transform_3.cpp b/test/user_expression_transform_3.cpp
index b09a79a..8ae3282 100644
--- a/test/user_expression_transform_3.cpp
+++ b/test/user_expression_transform_3.cpp
@@ -1,4 +1,6 @@
#include
+#include
+#include
#include
diff --git a/test/user_operator_and_eval_expression_as.cpp b/test/user_operator_and_eval_expression_as.cpp
index f0ce751..cfbe042 100644
--- a/test/user_operator_and_eval_expression_as.cpp
+++ b/test/user_operator_and_eval_expression_as.cpp
@@ -1,4 +1,4 @@
-#define BOOST_YAP_CONVERSION_OPERATOR_TEMPLATE
+#define BOOST_YAP_CONVERSION_OPERATOR_TEMPLATE 1
#include
#include
diff --git a/test/user_operator_eval.cpp b/test/user_operator_eval.cpp
index 48385d5..5ea9e5e 100644
--- a/test/user_operator_eval.cpp
+++ b/test/user_operator_eval.cpp
@@ -1,4 +1,4 @@
-#define BOOST_YAP_CONVERSION_OPERATOR_TEMPLATE
+#define BOOST_YAP_CONVERSION_OPERATOR_TEMPLATE 1
#include
#include