arpadboda commented on a change in pull request #926:
URL: https://github.com/apache/nifi-minifi-cpp/pull/926#discussion_r508692793



##########
File path: libminifi/include/utils/Id.h
##########
@@ -65,10 +67,11 @@ class Identifier {
 
   bool operator!=(const Identifier& other) const;
   bool operator==(const Identifier& other) const;
+  bool operator<(const Identifier& other) const;
 
   bool isNil() const;
 
-  std::string to_string() const;
+  SmallString<36> to_string() const;

Review comment:
       As far as I see smallsring<N> cannot be constructed (even explicitly) 
from const char * with the proper length. Which is exactly what I would like to 
achieve. 
   You can convert smallstring (and any typedefs based to that) to string, but 
you cannot anyhow create those by accident, only well designed APIs should be 
provide an instance of these. 
   
   ```
   std::array<char, 10> temp_str = "banana123";
   
   12:36: error: conversion from 'const char [10]' to non-scalar type 
'std::array<char, 10ul>' requested
   ```
   
   And I don't see any user-defined ctor in our code to make it possible. 
   
   So the only thing we can do wrong is to typedef the same length of 
smallstring differently in different usecases. Which is a valid concerns as 
those could be mixed accidentally, but I don't think that living without 
typedefs helps that: if you see two APIs providing or requesting a given length 
of smallstr, you have no idea if they are compatible or not. 
   




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to