Source: https://www3.nd.edu/~zxu2/acms60212-40212-S15/C++_notes.pdf