-
Notifications
You must be signed in to change notification settings - Fork 110
Improve MQTT_STD_XXX behavior #929
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
Improve MQTT_STD_XXX behavior #929
Conversation
…n MQTT_STD_XXX option is set. fix: Do not assume that std::string_view is constructable from a pair of iterators because that requires C++20. fix: Correctly check for std::make_shared<T[]> support
…in is a fancy iterator. It was also incorrectly calculating the size of the string_view
Codecov Report
@@ Coverage Diff @@
## master #929 +/- ##
==========================================
- Coverage 83.08% 83.06% -0.02%
==========================================
Files 64 65 +1
Lines 10357 10358 +1
==========================================
- Hits 8605 8604 -1
- Misses 1752 1754 +2 |
…ke a pair of iterators
@@ -358,7 +358,7 @@ class retained_topic_map { | |||
void dump(Output &out) { | |||
auto const& direct_index = map.template get<direct_index_tag>(); | |||
for (auto const& i : direct_index) { | |||
out << i.parent_id << " " << i.name << " " << (i.value ? "init" : "-") << " " << i.count << std::endl; | |||
out << i.parent_id << " " << i.name << " " << (i.value ? "init" : "-") << " " << i.count << '\n'; |
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 this replacement is needed ? Just avoid include ostream
?
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.
Correct, seeing that this is the only use of ostream
in this file and this function is a debug function.
Thanks you for update. |
What
std::make_shared<T[]>
. See https://en.cppreference.com/w/cpp/feature_testretained_topic_map.hpp
just to get access tostd::endl
, use'\n'
instead.Why
Including headers that are not used unnecessarily increases compile times. It is considered good practice to include only what you use.
Enabling the MQTT_STD_XXX options should not assume presence of full C++20 support, otherwise a user's application might not compile even if they are using C++17 with access to such std types.