First scan
##First scan
using Real = double
- not bad, but I would use another template parameter (defaulted to double
).
Queue
- now we know it is actually std::priority_queue
(which is heap).
- Why removing from highest (not least) distance?
- Why
Pair
from pop, butReal
from peek? - Why heap at all? It could be constructed as a heap, but it is rather used as a set/vector/deque once it is returned. Maybe
Matches
would be better name for it (you should describe the purpose, not the internal structure), but I am no expert to know what is the real purpose and what algorithms can be used.
TPayload
vs. Batch
- the later seems to allow multiple nodes (e.g. cities or what payload can be) in same place + accept/return list of such nodes/elements. What I am really missing is some Doxygen documentation describing every method and adding some usage example (note: the example was edited in the question while I was writing this review).
void insert (const TVector& position, const Batch& toInsert);
- I would personally add another method taking pair of iterators:
template<class It> void insert(const TVector& position, It from, It to) {
static_assert(std::is_same<TPayload,std::iterator_traits<It>::value_type>::value, ...);
std::size_t computeSize() const;
- what is that method doing? Number of vectors? Something different?
The names and design
##The names and design
TheThe Structure
looks like std::(multi)map
, where TVector
is something like location/position (seen in example) - a key - and TPayload
is the value. Why not naming it that way? As already mentioned, TVector
may describe what is it about, but still is too connected with the implementation, not the purpose. (The location could be enumeration and our metric could measure the distance using dijkstra or whatever algorithm.)
findFirstExactNearest
vs. findExactNearest
+ Batch
: I would take inspiration in std::equal_range
and use pair of iterators - there would be no need for Batch
and the two methods could be made one.
ExactNearest
vs. ApproximateNearest
: which of the two will be most used? What about adding another template parameter (bool
or enum (class)
) for it? The name could then be simply nearest
(find
can be removed as well).
##First scan
using Real = double
- not bad, but I would use another template parameter (defaulted to double
).
Queue
- now we know it is actually std::priority_queue
(which is heap).
- Why removing from highest (not least) distance?
- Why
Pair
from pop, butReal
from peek? - Why heap at all? It could be constructed as a heap, but it is rather used as a set/vector/deque once it is returned. Maybe
Matches
would be better name for it (you should describe the purpose, not the internal structure), but I am no expert to know what is the real purpose and what algorithms can be used.
TPayload
vs. Batch
- the later seems to allow multiple nodes (e.g. cities or what payload can be) in same place + accept/return list of such nodes/elements. What I am really missing is some Doxygen documentation describing every method and adding some usage example (note: the example was edited in the question while I was writing this review).
void insert (const TVector& position, const Batch& toInsert);
- I would personally add another method taking pair of iterators:
template<class It> void insert(const TVector& position, It from, It to) {
static_assert(std::is_same<TPayload,std::iterator_traits<It>::value_type>::value, ...);
std::size_t computeSize() const;
- what is that method doing? Number of vectors? Something different?
##The names and design
The Structure
looks like std::(multi)map
, where TVector
is something like location/position (seen in example) - a key - and TPayload
is the value. Why not naming it that way? As already mentioned, TVector
may describe what is it about, but still is too connected with the implementation, not the purpose. (The location could be enumeration and our metric could measure the distance using dijkstra or whatever algorithm.)
findFirstExactNearest
vs. findExactNearest
+ Batch
: I would take inspiration in std::equal_range
and use pair of iterators - there would be no need for Batch
and the two methods could be made one.
ExactNearest
vs. ApproximateNearest
: which of the two will be most used? What about adding another template parameter (bool
or enum (class)
) for it? The name could then be simply nearest
(find
can be removed as well).
First scan
using Real = double
- not bad, but I would use another template parameter (defaulted to double
).
Queue
- now we know it is actually std::priority_queue
(which is heap).
- Why removing from highest (not least) distance?
- Why
Pair
from pop, butReal
from peek? - Why heap at all? It could be constructed as a heap, but it is rather used as a set/vector/deque once it is returned. Maybe
Matches
would be better name for it (you should describe the purpose, not the internal structure), but I am no expert to know what is the real purpose and what algorithms can be used.
TPayload
vs. Batch
- the later seems to allow multiple nodes (e.g. cities or what payload can be) in same place + accept/return list of such nodes/elements. What I am really missing is some Doxygen documentation describing every method and adding some usage example (note: the example was edited in the question while I was writing this review).
void insert (const TVector& position, const Batch& toInsert);
- I would personally add another method taking pair of iterators:
template<class It> void insert(const TVector& position, It from, It to) {
static_assert(std::is_same<TPayload,std::iterator_traits<It>::value_type>::value, ...);
std::size_t computeSize() const;
- what is that method doing? Number of vectors? Something different?
The names and design
The Structure
looks like std::(multi)map
, where TVector
is something like location/position (seen in example) - a key - and TPayload
is the value. Why not naming it that way? As already mentioned, TVector
may describe what is it about, but still is too connected with the implementation, not the purpose. (The location could be enumeration and our metric could measure the distance using dijkstra or whatever algorithm.)
findFirstExactNearest
vs. findExactNearest
+ Batch
: I would take inspiration in std::equal_range
and use pair of iterators - there would be no need for Batch
and the two methods could be made one.
ExactNearest
vs. ApproximateNearest
: which of the two will be most used? What about adding another template parameter (bool
or enum (class)
) for it? The name could then be simply nearest
(find
can be removed as well).
##First scan
using Real = double
- not bad, but I would use another template parameter (defaulted to double
).
Queue
- now we know it is actually std::priority_queue
(which is heap).
- Why removing from highest (not least) distance?
- Why
Pair
from pop, butReal
from peek? - Why heap at all? It could be constructed as a heap, but it is rather used as a set/vector/deque once it is returned. Maybe
Matches
would be better name for it (you should describe the purpose, not the internal structure), but I am no expert to know what is the real purpose and what algorithms can be used.
TPayload
vs. Batch
- the later seems to allow multiple nodes (e.g. cities or what payload can be) in same place + accept/return list of such nodes/elements. What I am really missing is some Doxygen documentation describing every method and adding some usage example (note: the example was edited in the question while I was writing this review).
void insert (const TVector& position, const Batch& toInsert);
- I would personally add another method taking pair of iterators:
template<class It> void insert(const TVector& position, It from, It to) {
static_assert(std::is_same<TPayload,std::iterator_traits<It>::value_type>::value, ...);
std::size_t computeSize() const;
- what is that method doing? Number of vectors? Something different?
##The names and design
The Structure
looks like std::(multi)map
, where TVector
is something like location/position (seen in example) - a key - and TPayload
is the value. Why not naming it that way? As already mentioned, TVector
may describe what is it about, but still is too connected with the implementation, not the purpose. (The location could be enumeration and our metric could measure the distance using dijkstra or whatever algorithm.)
findFirstExactNearest
vs. findExactNearest
+ Batch
: I would take inspiration in std::equal_range
and use pair of iterators - there would be no need for Batch
and the two methods could be made one.
ExactNearest
vs. ApproximateNearest
: which of the two will be most used? What about adding another template parameter (bool
or enum (class)
) for it? The name could then be simply nearest
(find
can be removed as well).
##First scan
using Real = double
- not bad, but I would use another template parameter (defaulted to double
).
Queue
- now we know it is actually std::priority_queue
(which is heap).
- Why removing from highest (not least) distance?
- Why
Pair
from pop, butReal
from peek? - Why heap at all? It could be constructed as a heap, but it is rather used as a set/vector/deque once it is returned. Maybe
Matches
would be better name for it (you should describe the purpose, not the internal structure), but I am no expert to know what is the real purpose and what algorithms can be used.
TPayload
vs. Batch
- the later seems to allow multiple nodes (e.g. cities or what payload can be) in same place + accept/return list of such nodes/elements. What I am really missing is some Doxygen documentation describing every method and adding some usage example (note: the example was edited in the question while I was writing this review).
void insert (const TVector& position, const Batch& toInsert);
- I would personally add another method taking pair of iterators:
template<class It> void insert(const TVector& position, It from, It to) {
static_assert(std::is_same<TPayload,std::iterator_traits<It>::value_type>::value, ...);
std::size_t computeSize() const;
- what is that method doing? Number of vectors? Something different?
##The names and design
The Structure
looks like std::(multi)map
, where TVector
is something like location/position (seen in example) - a key - and TPayload
is the value. Why not naming it that way? As already mentioned, TVector
may describe what is it about, but still is too connected with the implementation, not the purpose. (The location could be enumeration and our metric could measure the distance using dijkstra or whatever algorithm.)
findFirstExactNearest
vs. findExactNearest
+ Batch
: I would take inspiration in std::equal_range
and use pair of iterators - there would be no need for Batch
and the two methods could be made one.
##First scan
using Real = double
- not bad, but I would use another template parameter (defaulted to double
).
Queue
- now we know it is actually std::priority_queue
(which is heap).
- Why removing from highest (not least) distance?
- Why
Pair
from pop, butReal
from peek? - Why heap at all? It could be constructed as a heap, but it is rather used as a set/vector/deque once it is returned. Maybe
Matches
would be better name for it (you should describe the purpose, not the internal structure), but I am no expert to know what is the real purpose and what algorithms can be used.
TPayload
vs. Batch
- the later seems to allow multiple nodes (e.g. cities or what payload can be) in same place + accept/return list of such nodes/elements. What I am really missing is some Doxygen documentation describing every method and adding some usage example (note: the example was edited in the question while I was writing this review).
void insert (const TVector& position, const Batch& toInsert);
- I would personally add another method taking pair of iterators:
template<class It> void insert(const TVector& position, It from, It to) {
static_assert(std::is_same<TPayload,std::iterator_traits<It>::value_type>::value, ...);
std::size_t computeSize() const;
- what is that method doing? Number of vectors? Something different?
##The names and design
The Structure
looks like std::(multi)map
, where TVector
is something like location/position (seen in example) - a key - and TPayload
is the value. Why not naming it that way? As already mentioned, TVector
may describe what is it about, but still is too connected with the implementation, not the purpose. (The location could be enumeration and our metric could measure the distance using dijkstra or whatever algorithm.)
findFirstExactNearest
vs. findExactNearest
+ Batch
: I would take inspiration in std::equal_range
and use pair of iterators - there would be no need for Batch
and the two methods could be made one.
ExactNearest
vs. ApproximateNearest
: which of the two will be most used? What about adding another template parameter (bool
or enum (class)
) for it? The name could then be simply nearest
(find
can be removed as well).
##First scan
using Real = double
- not bad, but I would use another template parameter (defaulted to double
).
Queue
- now we know it is actually std::priority_queue
(which is heap).
- Why removing from highest (not least) distance?
- Why
Pair
from pop, butReal
from peek? - Why heap at all? It could be constructed as a heap, but it is rather used as a set/vector/deque once it is returned. Maybe
Matches
would be better name for it (you should describe the purpose, not the internal structure), but I am no expert to know what is the real purpose and what algorithms can be used.
TPayload
vs. Batch
- the later seems to allow multiple nodes (e.g. cities or what payload can be) in same place + accept/return list of such nodes/elements. What I am really missing is some Doxygen documentation describing every method and adding some usage example (note: the example was edited in the question while I was writing this review).
void insert (const TVector& position, const Batch& toInsert);
- I would personally add another method taking pair of iterators:
template<class It> void insert(const TVector& position, It from, It to) {
static_assert(std::is_same<TPayload,std::iterator_traits<It>::value_type>::value, ...);
std::size_t computeSize() const;
- what is that method doing? Number of vectors? Something different?
##The names and design
The Structure
looks like std::(multi)map
, where TVector
is something like location/position (seen in example) - a key - and TPayload
is the value. Why not naming it that way? As already mentioned, TVector
may describe what is it about, but still is too connected with the implementation, not the purpose. (The location could be enumeration and our metric could measure the distance using dijkstra or whatever algorithm.)
findFirstExactNearest
vs. findExactNearest
+ Batch
: I would take inspiration in std::equal_range
and use pair of iterators - there would be no need for Batch
and the two methods could be made one.