Skip to content

Commit 94ff37d

Browse files
committed
updates README
1 parent 1dedb0c commit 94ff37d

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,11 @@ auto* expr_raw = make_expr(&my_type::my_bool, op::equals, true);
134134
delete expr_raw;
135135
```
136136
137-
// TODO document the three make_expr functions
137+
The `make_expr` helper function is templated and overloaded to allow for maximum compatibility for use within expressions. There are three definitions of `make_expr`:
138+
* One that accepts a reference to a value-type class member variable, an operator function, and a comparison value (whose type matches the given class member variable);
139+
* One that accepts a reference to a pointer-type class member variable, an operator function, and a pointer to a comparison value (whose type matches the given class member variable); and
140+
* One that accepts a reference to a const class member function, an operator function, and a comparison value (whose type matches the return type of the given const class member function)
141+
138142
139143
Please see the section below for more information about expression tree nodes.
140144

include/attwoodn/expression_tree.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,15 +384,15 @@ namespace attwoodn::expression_tree {
384384
* Makes an expression tree leaf node for comparing value-type member variables of a class/struct
385385
*/
386386
template<typename Obj, typename CompValue, typename Op = typename type_id<bool (*)(CompValue, CompValue)>::type>
387-
node::expression_tree_leaf_node<Obj, Op, CompValue>* make_expr( const CompValue Obj::* member_var, Op op, CompValue comp_value ) {
387+
node::expression_tree_leaf_node<Obj, Op, CompValue>* make_expr( const CompValue Obj::* member_var, Op op, const CompValue comp_value ) {
388388
return new node::expression_tree_leaf_node<Obj, Op, CompValue>( member_var, op, comp_value );
389389
}
390390

391391
/**
392392
* Makes an expression tree leaf node for comparing the return value from a class/struct's const member function
393393
*/
394394
template<typename Obj, typename CompValue, typename Op = typename type_id<bool (*)(CompValue, CompValue)>::type>
395-
node::expression_tree_leaf_node<Obj, Op, CompValue>* make_expr( CompValue (Obj::* member_func)() const, Op op, CompValue comp_value ) {
395+
node::expression_tree_leaf_node<Obj, Op, CompValue>* make_expr( CompValue (Obj::* member_func)() const, Op op, const CompValue comp_value ) {
396396
return new node::expression_tree_leaf_node<Obj, Op, CompValue>( member_func, op, comp_value );
397397
}
398398

0 commit comments

Comments
 (0)