codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
#ifndef DIVIDE_HPP_INCLUDED #define DIVIDE_HPP_INCLUDED template <typename T, typename Policy> T divide(T a, T b, const Policy& pol) { if (b == 0) { return policies::raise_domain_error("divide(a, b)", "Cannot divide by zero", T(0), // Value to be returned pol // Our policy ); } return a / b; } template <typename T> inline T divide(T a, T b) { return divide(a, b, policies::default_domain_policy()); } #endif
Private
[
?
]
Run code