Library: fix unwanted implicit conversion

...it should have been explicit from start, since there is no point
in converting an EntryID into a plain flat string without further notice

this became evident, when the compiler picked the string overload on

MakeRec().genNode(specialID)

...which is in compliance to the rules, since string is a direct match,
while BareEntryID would be an (slicing) upcast. However, obviously we
want the BareEntryID here, and not an implicit string conversion,
thereby discarding the special hash value hidden within the ID
This commit is contained in:
Fischlurch 2018-11-09 23:09:16 +01:00
parent 7cc68fadea
commit 8432420726
2 changed files with 3 additions and 3 deletions

View file

@ -265,7 +265,7 @@ namespace idi {
return static_cast<EntryID const&> (bID);
}
explicit
operator string() const;
friend bool operator< (EntryID const& i1, EntryID const& i2) { return i1.getSym() < i2.getSym(); }

View file

@ -96,7 +96,7 @@ namespace test {
Asset::Ident idi = thePipe->ident;
CHECK (idi.org == "lumi");
CHECK (contains (idi.name, thePipe->getPipeID()));
CHECK (contains (idi.name, thePipe->getStreamID()));
CHECK (contains (idi.name, string{thePipe->getStreamID()}));
Category cat{idi.category};
Category refcat{STRUCT,"pipes"};
@ -146,7 +146,7 @@ namespace test {
pipe2 = asset::Struct::retrieve (Query<Pipe>{"pipe(default)"});
CHECK (pipe2 == pipe1);
string sID = pipe1->getStreamID(); // sort of a "default stream type"
auto sID = string{pipe1->getStreamID()}; // sort of a "default stream type"
PPipe pipe3 = Pipe::query ("stream("+sID+")");
CHECK (pipe3);
CHECK (pipe3->getStreamID() == StreamType::ID{sID});