0

I am using a C++ library (Apache arrow) that has it own types (i.e. arrow::Int64Type) and each type has its an equivalent c_type that is access by using Type::ctype. For example

arrow::Int64Type::ctype x; is equivalent to int x;

I am using the arrow type as a template parameter and I would like to define a member variable of the ctype associated with the arrow type. Something like this:

template<class T>
struct S {
    T member_of_arrow_type;
    T::ctype member_of_c_type; // this does not work
    void foo()
    {
        std::cout << typeid(member_of_c_type).name() << std::endl;
    }
};

int main
{
  S<arrow::Int64Type> x;
  x.foo(); // this should print "int"

  S<arrow::DoubleType> x;
  x.foo(); // this should print "double"
}

Is it possible to do it in C++17?

motam79
  • 2,718
  • 1
  • 23
  • 41

0 Answers0