// BoxOperators.cpp // CBox object operations that don't need to access private members #include "Box.h" // Function for testing if a constant is > a CBox object bool operator>(const double& value, const CBox& aBox) { return value > aBox.Volume(); } // Function for testing if a constant is < CBox object bool operator<(const double& value, const CBox& aBox) { return value < aBox.Volume(); } // Function for testing if CBox object is > a constant bool operator>(const CBox& aBox, const double& value) { return value < aBox; } // Function for testing if CBox object is < a constant bool operator<( const CBox& aBox, const double& value) { return value > aBox; } // Function for testing if a constant is >= a CBox object bool operator>=(const double& value, const CBox& aBox) { return value >= aBox.Volume(); } // Function for testing if a constant is <= CBox object bool operator<=(const double& value, const CBox& aBox) { return value <= aBox.Volume(); } // Function for testing if CBox object is >= a constant bool operator>=( const CBox& aBox, const double& value) { return value <= aBox; } // Function for testing if CBox object is <= a constant bool operator<=( const CBox& aBox, const double& value) { return value >= aBox; } // Function for testing if a constant is == CBox object bool operator==(const double& value, const CBox& aBox) { return value == aBox.Volume(); } // Function for testing if CBox object is == a constant bool operator==(const CBox& aBox, const double& value) { return value == aBox; } // CBox multiply operator n*aBox CBox operator*(int n, const CBox& aBox) { return aBox * n; } // Operator to return the free volume in a packed CBox double operator%( const CBox& aBox, const CBox& bBox) { return aBox.Volume() - (aBox / bBox) * bBox.Volume(); }