-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove boost refs #108
Remove boost refs #108
Conversation
@@ -107,7 +105,7 @@ adam_test_parser::adam_test_parser(std::istream& in_stream, const line_position_ | |||
// namespace { | |||
|
|||
// inline name_t qs_name(const queryable_sheet_t* qs) { return qs->name(); } | |||
// adobe::find(sheets_m, boost::bind(&qs_name, _1) == sheet_name); | |||
// adobe::find(sheets_m, std::bind(&qs_name, _1) == sheet_name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could probably just delete this commented code?
@@ -1069,7 +1069,7 @@ inline typename table_index<Key, T, Compare, Transform>::iterator | |||
table_index<Key, T, Compare, Transform>::lower_bound(const key_type& key) { | |||
return adobe::lower_bound( | |||
index_m, key, compare_m, | |||
boost::bind(transform_m, bind(indirect<value_type>(), boost::placeholders::_1))); | |||
std::bind(transform_m, bind(indirect<value_type>(), std::placeholders::_1))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you consider turning these into lambdas? I see you did that elsewhere in this PR.
@@ -721,8 +718,8 @@ void sheet_t::implementation_t::add_output(name_t name, const line_position_t& p | |||
const array_t& expression) { | |||
// REVISIT (sparent) : Non-transactional on failure. | |||
cell_set_m.push_back(cell_t(access_output, name, | |||
boost::bind(&implementation_t::calculate_expression, | |||
boost::ref(*this), position, expression), | |||
std::bind(&implementation_t::calculate_expression, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question here re: defining a lambda instead of using std::bind
.
source/adam_evaluate.cpp
Outdated
suite.add_interface_proc_m = | ||
boost::bind(&adobe::sheet_t::add_interface, boost::ref(sheet), _1, _2, _3, _4, _5, _6); | ||
|
||
suite.add_cell_proc_m = std::bind(&add_cell, std::ref(sheet), _1, _2, _3, _4); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question here re: bind -> lambda.
source/adam_parser.cpp
Outdated
@@ -86,15 +83,15 @@ namespace adobe { | |||
|
|||
adam_parser::adam_parser(std::istream& in, const line_position_t& position) | |||
: expression_parser(in, position) { | |||
set_keyword_extension_lookup(boost::bind(&keyword_lookup, _1)); | |||
set_keyword_extension_lookup(std::bind(&keyword_lookup, _1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these still necessary? Will this line compile without the bind?
(And so throughout this file.)
suite.add_interface_proc_m = | ||
boost::bind(&adobe::sheet_t::add_interface, boost::ref(sheet), _1, _2, _3, _4, _5, _6); | ||
suite.finalize_sheet_proc_m = boost::bind(&sheet_t::update, boost::ref(sheet)); | ||
suite.add_view_proc_m = std::bind( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider bind -> lambda?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general I am in favor of this change - thank you for the contribution! My main questions are around the use of std::bind
, and instead migrating the code that uses it to lambdas instead. Lambdas are much easier to read than std::bind expressions, so I am wondering if it would be valuable to transcribe some uses of bind
to lambdas instead.
I will have to defer final approval of these changes to @sean-parent and the other stlab maintainers. But again, thank you for your help in removing these dependencies in favor of Standard alternatives.
adobe/json_helper.hpp
Outdated
@@ -9,7 +9,6 @@ | |||
#define ADOBE_JSON_HELPER_HPP | |||
|
|||
#include <adobe/any_regular.hpp> | |||
#include <adobe/array.hpp> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you removing adobe/array.hpp when adobe::array_t is used in this file?
boost::function_requires<boost::BidirectionalIteratorConcept<forest<int>::const_iterator>>(); | ||
boost::function_requires<boost::BidirectionalIteratorConcept<forest<int>::preorder_iterator>>(); | ||
boost::function_requires< | ||
std::function_requires<boost::BidirectionalIteratorConcept<forest<int>::iterator>>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
boost::function_requires is part of boost concept checks, there is no direct std:: equivalent. This code will not compile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a number of places where boost headers are removed and the equivalent standard headers are not added. A couple of places where an adobe/
header is removed even though the declarations within are used in the file. boost::function_requires
was renamed even though there is no direct equivalent in the standard (some of this could be replaced with static asserts and standard type traits if you feel so inclined).
For the bind expressions - the transformation to a lambda, would be nice, but is also error prone. The one place a saw it you mapped a cref to a & capture, which is not the same (cref's can be copied and express immutability). With just a quick review of the change it is unclear if this is a correct transformation. Unless you are up for a careful analysis, I would recommend just mapping boost::bind
to std::bind
for now.
The code does not pass CI on any platform and it is clear the unit tests have not been run locally before submitting the PR.
Please make sure the changes build and run on at least one platform before submitting a PR.
I saw the additional commit - (at least) this issue hasn't been addressed. |
const array_t& initializer, const line_position_t& position2, | ||
const array_t& expression, const std::string& brief, | ||
const std::string& detailed) -> void { | ||
sheet.add_interface(name, linked, position1, initializer, position2, expression); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a mismatch between signatures of add_interface_proc_m
and sheet_t::add_interface
. While former has 8 args, later has only 6.
using add_interface_proc_t = std::function<void(
name_t cell_name, bool linked, const line_position_t& position1, const array_t& initializer,
const line_position_t& position2, const array_t& expression, const std::string& brief,
const std::string& detailed)>;
void sheet_t::add_interface(name_t name, bool linked, const line_position_t& position1,
const array_t& initializer, const line_position_t& position2,
const array_t& expression)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe boost bind just drops the extra arguments. Ifstd::bind
behaves differently, I'm fine with the lambda here (the two missing arguments are for comments from the parser but the sheet doesn't do anything with them.
@@ -70,8 +70,8 @@ void place(T& t, const place_data_t& place_data) { t.place(place_data); } | |||
\ingroup placeable_concept | |||
*/ | |||
template <PlaceableConcept T> | |||
concept_map PlaceableConcept<boost::reference_wrapper<T>>{ | |||
void measure(boost::reference_wrapper<T> & r, | |||
concept_map PlaceableConcept<std::reference_wrapper<T>>{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Include the appropriate header.
There are two minor comments on the code (one missing header and one comment on bind->lambda). I'm not sure why CI is failing. |
} | ||
|
||
for (queryable_sheet_t::index_t::iterator iter = output_index_m.begin(), | ||
e = output_index_m.end(); | ||
iter != e; ++iter) { | ||
std::size_t i(iter->second); | ||
sheet_m.monitor_value(name_m[i], boost::bind(adobe::assign(), _1, boost::ref(value_m[i]))); | ||
sheet_m.monitor_value(name_m[i], [&value_m_at_index_i = value_m[i]](any_regular_t val) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With clang-14/16, std::bind
is not working with type any_regular_t
for adobe::assign
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have an understanding of why? Maybe it would be better to fix the underlying cause.
@@ -38,7 +38,7 @@ | |||
/**************************************************************************************************/ | |||
|
|||
using namespace std; | |||
using namespace std::placeholders; | |||
namespace ph = std::placeholders; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is ugly. What is the ambiguity? Before accepting this change, I'd like to understand the issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A quick test - https://godbolt.org/z/Ydjff99Mo
Where does the ambiguity originate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error message is as following, boost/bind.hpp
is indirectly included through boost/signals2/signal.hpp
.
/root/expr/adobe_source_libraries/source/adam.cpp: In member function ‘adobe::sheet_t::connection_t adobe::sheet_t::implementation_t::monitor_enabled(adobe::name_t, const adobe::name_t*, const adobe::name_t*, const monitor_enabled_t&)’:
/root/expr/adobe_source_libraries/source/adam.cpp:939:92: error: reference to ‘_1’ is ambiguous
939 | touch_set, iter->cell_set_pos_m, monitor, _1, _2));
| ^~
In file included from /root/expr/adobe_source_libraries/source/../adobe/adam.hpp:13,
from /root/expr/adobe_source_libraries/source/adam.cpp:8:
/usr/include/c++/9/functional:211:34: note: candidates are: ‘const std::_Placeholder<1> std::placeholders::_1’
211 | extern const _Placeholder<1> _1;
| ^~
In file included from /usr/include/boost/bind/bind.hpp:2356,
from /usr/include/boost/bind.hpp:22,
from /usr/include/boost/signals2/slot.hpp:15,
from /usr/include/boost/signals2/connection.hpp:24,
from /usr/include/boost/signals2/signal.hpp:22,
from /root/expr/adobe_source_libraries/source/../adobe/adam.hpp:16,
from /root/expr/adobe_source_libraries/source/adam.cpp:8:
/usr/include/boost/bind/placeholders.hpp:46:38: note: ‘constexpr const boost::arg<1> boost::placeholders::_1’
46 | BOOST_STATIC_CONSTEXPR boost::arg<1> _1;
Checking the build. I made a couple of comments that I'd like to understand better. Regarding // `assign` is a function object type for the assignment operator.
// `assign{}(x, r)` is equivalent to `(void)(r = x)`
struct assign {
typedef void result_type;
template <class T, class U>
void operator()(T&& x, U& r) {
r = std::forward<T>(x);
}
}; |
Getting same error with new implementation of
|
I set up my own branch (and opened another PR for CI) to play with this. My first theory is it was caused by how the assignment is declared in |
I will close this PR - the code was moved to PR109 so I can play with solving the |
No description provided.