diff --git a/detail/expression.hpp b/detail/expression.hpp new file mode 100644 index 0000000..ce352a6 --- /dev/null +++ b/detail/expression.hpp @@ -0,0 +1,77 @@ +#ifndef BOOST_PROTO17_DETAIL_EXPRESSION_HPP_INCLUDED +#define BOOST_PROTO17_DETAIL_EXPRESSION_HPP_INCLUDED + +#include "../expression_fwd.hpp" + +#include + + +namespace boost::proto17 { + + namespace detail { + + template + struct partial_decay + { + using type = T; + }; + + template + struct partial_decay { using type = T *; }; + template + struct partial_decay { using type = T *; }; + + template + struct partial_decay { using type = T *; }; + template + struct partial_decay { using type = T *; }; + + template + struct partial_decay { using type = R(*)(A...); }; + template + struct partial_decay { using type = R(*)(A..., ...); }; + + template ::type, + bool AddRValueRef = std::is_same_v && !std::is_const_v> + struct rhs_value_type_phase_1; + + template + struct rhs_value_type_phase_1 + { using type = U &&; }; + + template + struct rhs_value_type_phase_1 + { using type = U; }; + + template + struct is_expr + { static bool const value = false; }; + + template + struct is_expr> + { static bool const value = true; }; + + template ::type, + bool RemoveRefs = std::is_rvalue_reference_v, + bool IsExpr = is_expr>::value> + struct rhs_type; + + template + struct rhs_type + { using type = std::remove_cv_t>; }; + + template + struct rhs_type + { using type = terminal>; }; + + template + struct rhs_type + { using type = terminal; }; + + } + +} + +#endif diff --git a/expression_fwd.hpp b/expression_fwd.hpp index 11d92c0..7828c18 100644 --- a/expression_fwd.hpp +++ b/expression_fwd.hpp @@ -1,6 +1,8 @@ #ifndef BOOST_PROTO17_EXPRESSION_FWD_HPP_INCLUDED #define BOOST_PROTO17_EXPRESSION_FWD_HPP_INCLUDED +#include + namespace boost::proto17 { @@ -17,6 +19,12 @@ namespace boost::proto17 { template struct expression; + template + using terminal = expression; + + template + using placeholder = expression>; + } #endif diff --git a/operators.hpp b/operators.hpp index 8bba6ef..826904c 100644 --- a/operators.hpp +++ b/operators.hpp @@ -1,8 +1,6 @@ #ifndef BOOST_PROTO17_OPERATORS_HPP_INCLUDED #define BOOST_PROTO17_OPERATORS_HPP_INCLUDED -#include "expression_fwd.hpp" - namespace boost::proto17 { diff --git a/sketch.cpp b/sketch.cpp index 591f607..02704fa 100644 --- a/sketch.cpp +++ b/sketch.cpp @@ -1,6 +1,7 @@ #include "expression_fwd.hpp" #include "operators.hpp" +#include "detail/expression.hpp" #define BOOST_PROTO17_STREAM_OPERATORS // TODO: For testing. #include "print.hpp" @@ -18,71 +19,8 @@ namespace boost::proto17 { - template - using terminal = expression; - namespace detail { - template - struct partial_decay - { - using type = T; - }; - - template - struct partial_decay { using type = T *; }; - template - struct partial_decay { using type = T *; }; - - template - struct partial_decay { using type = T *; }; - template - struct partial_decay { using type = T *; }; - - template - struct partial_decay { using type = R(*)(A...); }; - template - struct partial_decay { using type = R(*)(A..., ...); }; - - template ::type, - bool AddRValueRef = std::is_same_v && !std::is_const_v> - struct rhs_value_type_phase_1; - - template - struct rhs_value_type_phase_1 - { using type = U &&; }; - - template - struct rhs_value_type_phase_1 - { using type = U; }; - - template - struct is_expr - { static bool const value = false; }; - - template - struct is_expr> - { static bool const value = true; }; - - template ::type, - bool RemoveRefs = std::is_rvalue_reference_v, - bool IsExpr = is_expr>::value> - struct rhs_type; - - template - struct rhs_type - { using type = std::remove_cv_t>; }; - - template - struct rhs_type - { using type = terminal>; }; - - template - struct rhs_type - { using type = terminal; }; - template auto default_eval_expr (expression const & expr, Tuple && tuple) { @@ -194,9 +132,6 @@ namespace boost::proto17 { } }; - template - using placeholder = expression>; - namespace literals { template