iceoryx icon indicating copy to clipboard operation
iceoryx copied to clipboard

Convenience functions for `cxx::string`

Open FerdinandSpitzschnueffler opened this issue 2 years ago • 1 comments

Brief feature description

This is an issue to collect convenience functions for the cxx::string which would be nice to have but are not urgently needed.

Detailed information

  • add c'tor that constructs the iox::string with count copies of a character
    iox::string<10> str(TruncateToCapacity, count, 'M');    // count as runtime parameter
    iox::string<10> str(count, 'M');    // count as compile time constant
    
  • remove characters from the iox::string
    iox::string<10> str("someString");
    str.erase(5, 2);    // str == someSing
    str.erase(7);    // str == someSin
    

Nice. But is TruncateToCapacity necessary? I guess yes when count is a runtime parameter but can we also have one with a compile time constant and then just a iox::cxx::string<10> a(5, 'M'); with a compile time error on iox::cxx::string<10> a(15, 'M'); ?

elBoberido avatar Jun 29 '22 14:06 elBoberido