MyraMath
Expression.h
Go to the documentation of this file.
1 // This file is part of MyraMath, copyright (c) 2014-2019 by Ryan A Chilton //
2 // and distributed by MyraCore, LLC. See LICENSE.txt for license terms. //
3 // ========================================================================= //
4 
5 #ifndef MYRAMATH_EXPRESSION_EXPRESSION_H
6 #define MYRAMATH_EXPRESSION_EXPRESSION_H
7 
13 #include <myramath/MYRAMATH_EXPORT.h>
15 
17 
18 #ifdef MYRAMATH_ENABLE_CPP11
19 #include <initializer_list>
20 #endif
21 
22 namespace myra {
23 
24 // Forward declarations.
25 namespace detail { template<int Arity, class Number> class ExpressionBase; }
26 
28 template<int Arity, class Number> class MYRAMATH_EXPORT Expression
29  {
30  public:
31 
32  // ------------------------------------ Value semantics.
33 
35  Expression();
36 
38  Expression(const detail::ExpressionBase<Arity,Number>& that);
39 
41  Expression(const Expression<Arity,Number>& that);
42 
44  void swap(Expression<Arity,Number>& that);
45 
48 
50  ~Expression();
51 
52  // ------------------------------------ Expression API.
53 
55  Index<Arity> size() const;
56 
58  Number evaluate(Index<Arity> i) const;
59 
60 #ifdef MYRAMATH_ENABLE_CPP11
61 
63  Number evaluate(std::initializer_list<int> i) const;
64 
65 #endif
66 
67  private:
68 
69  // Underlying polymorphic instance, an ExpressionBase.
71 
72  };
73 
74 } // namespace myra
75 
76 #endif
Implementation detail of Expression templates.
Definition: Expression.h:25
Definition: syntax.dox:1
Definition: random.cpp:45
Various utility functions/classes related to scalar Number types.
Given an index (i,j,etc), returns a value.
Definition: arithmetic.h:19