1 #ifndef OPAL_Indexer_HH
2 #define OPAL_Indexer_HH
30 namespace Expressions {
58 virtual void print(std::ostream &str,
int precedence = 99)
const;
75 template <
class T>
inline
78 lft(rhs.lft->clone()), rgt(rhs.rgt->clone())
82 template <
class T>
inline
88 template <
class T>
inline
93 template <
class T>
inline
99 template <
class T>
inline
101 std::vector<T> op1 = lft->evaluate();
102 int op2 = int(
Round(rgt->evaluate()));
104 if(op2 <= 0 || static_cast<unsigned>(op2) > op1.size()) {
105 throw CLRangeError(
"Expressions::Indexer()",
"Index out of range.");
112 template <
class T>
inline
122 #endif // OPAL_Indexer_HH
double Round(double value)
Round the double argument.
PtrToScalar< double > rgt
void operator=(const Indexer &)
A scalar expression to retrieve an indexed component from an array.
virtual Scalar< T > * clone() const
Make clone.
virtual void print(std::ostream &str, int precedence=99) const
Print expression.
virtual T evaluate() const
Evaluate.
A pointer to an array expression.