funcy  1.6.1
exceptions.h
1 #pragma once
2 
3 #include <stdexcept>
4 #include <string>
5 #include <type_traits>
6 
7 namespace funcy
8 {
21  class OutOfDomainException : public std::runtime_error
22  {
23  public:
33  template < class Value, class = std::enable_if_t< std::is_arithmetic< Value >::value > >
34  OutOfDomainException( const std::string& function, const std::string& range,
35  const Value& value, const std::string& file, const int line )
36  : std::runtime_error( std::string( "OutOfDomainException in " ) + file + " at line " +
37  std::to_string( line ) + ".\n " + function +
38  ": Argument " + std::to_string( value ) + " is outside range " +
39  range + ".\n" )
40  {
41  }
42  };
43 
45  class NonSymmetricMatrixException : public std::runtime_error
46  {
47  public:
57  template < class Value, class = std::enable_if_t< std::is_arithmetic< Value >::value > >
58  NonSymmetricMatrixException( const std::string& function, const Value& rows,
59  const Value& cols, const std::string& file, const int line )
60  : std::runtime_error( std::string( "NonSymmetricMatrixException in " ) + file +
61  " at line " + std::to_string( line ) + ".\n " +
62  function + ": Matrix of dimension " + std::to_string( rows ) +
63  "x" + std::to_string( cols ) + " is not symmetric.\n" )
64  {
65  }
66  };
68 } // namespace funcy
Exception for scalar function arguments that are outside the domain of the function.
Definition: exceptions.h:21
Main namespace of the funcy library.
OutOfDomainException(const std::string &function, const std::string &range, const Value &value, const std::string &file, const int line)
Constructor.
Definition: exceptions.h:34
Exception for non-symmetric matrices if symmetric matrices are required.
Definition: exceptions.h:45
NonSymmetricMatrixException(const std::string &function, const Value &rows, const Value &cols, const std::string &file, const int line)
Constructor.
Definition: exceptions.h:58