aimstil  5.0.5
fraction_policies.h
Go to the documentation of this file.
1 #ifndef TIL_FRACTION_POLICIES_H_
2 #define TIL_FRACTION_POLICIES_H_
3 
6 
7 namespace til { namespace policy
8 {
9 
10  //---------------------------------------------------------------------------
11 
14  {
15  class DivisionByZero : std::exception {};
16 
17  template < typename T >
18  T operator()(T&,T&)
19  {
20  throw DivisionByZero();
21  }
22  };
23 
24  //---------------------------------------------------------------------------
25 
28  {
29  template < typename T >
30  T operator()(T&,T&)
31  {
32  return T(0);
33  }
34  };
35 
36  //---------------------------------------------------------------------------
37 
38 }} // namespace til::policy
39 
40 
41 #endif /*FRACTION_POLICIES_H_*/
Belongs to package Box Do not include directly, include til/Box.h instead.
Definition: Accumulator.h:10