Home » U++ Library support » U++ Core » Request: please make Range classes compatible with Vector! (error: no matching function for call to 'Upp::SubRangeClass<const unsigned char*>::SubRangeClass()')
Request: please make Range classes compatible with Vector! [message #48849] |
Thu, 12 October 2017 07:20 |
piotr5
Messages: 107 Registered: November 2005
|
Experienced Member |
|
|
well, range isn't really moveable, actually it inherits moveable from the iterator it contains. however, I use it as Key to a map with iterator being just a pointer to some const characters. for that purpose I had to use NTL_MOVEABLE, create a "GetHashValue(const SubRangeClass&){return xxHash(...);}" and a specialization of SubRangeClass<const char*> containing an empty constructor.
the latter I see as a bug, SubRangeClass IMHO should have a constructor taking no arguments marked as protected, useable for its Vector friend. i.e. 2 changes: add containers making use of Create() or Add() or whatever to a list of friends for range classes, maybe put these additions into a friend-macro for others to use in their classes too. and then add SubRangeClass() constructor as a protected (or private) member.
The Range classes are a great addition to Upp! finally I can work with substrings without having to create yet another instance of the same text over and over again. however, in my observation substrings I actually need mostly for Keys in a Map, for example in a command-parser taking long commands or short ones which are a substring of the long commands. another use-case is indexing stuff for faster substring-search. it improves cache usage, often less memory is used too. if I had to enclose them in Value objects for storage, guess the overhead would kill some of these advantages...
|
|
|
Goto Forum:
Current Time: Mon Apr 29 04:08:08 CEST 2024
Total time taken to generate the page: 0.02754 seconds
|