0

I'm trying to use the QVM and ODEINT library. I'm using the qvm::vec<double,n> through a typedef as my state_type. I would like to use the subscript operator for ´state_type´. (To my knowledge ODEINT requires the subscript operator.) My problem is that QVM access operator is ´A(v)´ and doesn't implement the subscript operator. How would you overload the operator or solve this problem?

#include<bits/stdc++.h>
#include <boost/numeric/odeint.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/qvm.hpp>

using namespace std;

typedef boost::multiprecision::cpp_dec_float_50 value_type;

typedef boost::qvm::vec<value_type,3> triple;

int main()
{
 \\some code
}

Konrad Rudolph
  • 530,221
  • 131
  • 937
  • 1,214
orfvl
  • 111
  • 5
  • 3
    Typedefs are *aliases*, they don’t declare new types. Consequently you cannot create overloaded operators for them. You need to generate a façade instead — that is, wrap it inside your own type, which you need to explicitly implement. – Konrad Rudolph Dec 16 '21 at 09:14
  • 3
    Unrelated: [Why should I **not** `#include `?](https://stackoverflow.com/Questions/31816095/Why-Should-I-Not-Include-Bits-Stdc-H.) – Ted Lyngmo Dec 16 '21 at 09:15
  • Would do you mean with facade and how do I create it? – orfvl Dec 16 '21 at 09:28
  • Where did you learn that odeint requires the subscript operator? They have an example of using `std::list`, which doesn't have one... – molbdnilo Dec 16 '21 at 10:16
  • Please provide some more code, even if it won't work, to help us understand what your problem is. – zkoza Dec 22 '21 at 23:26

0 Answers0