how would std::min() behave on two 3d vectors? For example, isn't it hard to tell which one is bigger: v1 = Vector3D(1,3,5) or v2 = Vector3D(2,3,4). What will min(v1, v2) return? Will it return (1,3,4)? The smallest of each field? or just crash?
keenan
@fengyupeng Yes, great question. In this case, the min and max methods are defined componentwise, i.e., they would look something like this:
how would std::min() behave on two 3d vectors? For example, isn't it hard to tell which one is bigger: v1 = Vector3D(1,3,5) or v2 = Vector3D(2,3,4). What will min(v1, v2) return? Will it return (1,3,4)? The smallest of each field? or just crash?
@fengyupeng Yes, great question. In this case, the
min
andmax
methods are defined componentwise, i.e., they would look something like this:(and similarly for max).