Is there a data structure (readily available in STL or boost), that accepts two arguments and maps it to a certain value?
Examples would be for returning certain information in a coordinate grid or getting the weight of an edge in a graph:
coordinate_quadrant(-1,-1) = 3
weight_of(u,v) = 10
The quadrant example could be done in a simple function with four if statements. I’m mainly looking for an example that would suit the weight example. I’m trying to avoid having to create an edge class and pass that into the weight_of(Edge edge) function.
You could use std::map< std::pair<Type1,Type2>, Type3 >.