MINIFICPP-1325 - Separate process group processor lookups for IDs and names, allow constructing ID-s from strings#865
Conversation
… names, allow constructing ID-s from strings
884939e to
a959ef6
Compare
szaszm
left a comment
There was a problem hiding this comment.
For some reason I couldn't reply to the other review comments, so writing it here:
+1 for explicitly listing the captured variables, just for clarity, not safety.
…or to a value type
I would say listing the captured variables is just clutter-code in these cases. The lambdas mentioned capture everything in scope: there are no locals, |
libminifi/src/utils/Id.cpp
Outdated
| namespace minifi { | ||
| namespace utils { | ||
|
|
||
| const char* Identifier::UUID_FORMAT_STRING = "%02hhx%02hhx%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx-%02hhx%02hhx%02hhx%02hhx%02hhx%02hhx"; |
There was a problem hiding this comment.
would constexpr allow us to make it an in-class initializer?
There was a problem hiding this comment.
I think it only works in c++17 or maybe even c++14.
There was a problem hiding this comment.
you are right that from c++17 inline comes to the rescue, but even in c++11 we may (must) add an initializer to the declaration of a literal constexpr variable (and it is enough if it is not odr-used) (see here in section Constant static members)
#include <stdio.h>
struct A{
static constexpr const char* FORMAT = "%d\n";
};
int main(){
// uncommenting the following will generate a linker error
// auto& ref = A::FORMAT;
printf(A::FORMAT, 5);
}
it is not pivotal to move it to the header, I just wanted to share that it is possible
There was a problem hiding this comment.
Please make sure I can't reassign the string to something else. constexpr or top-level const achieves that.
There was a problem hiding this comment.
Made UUID_FORMAT_STRING constexpr.
This is a cleanup PR before I start a refactor on configuration parsing, IDs and names lookups.