arrow-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kouhei Sutou (JIRA)" <>
Subject [jira] [Created] (ARROW-486) [C++] arrow::io::MemoryMappedFile can't be casted to arrow::io::FileInterface
Date Sun, 15 Jan 2017 06:49:26 GMT
Kouhei Sutou created ARROW-486:

             Summary: [C++] arrow::io::MemoryMappedFile can't be casted to arrow::io::FileInterface
                 Key: ARROW-486
             Project: Apache Arrow
          Issue Type: Bug
          Components: C++
    Affects Versions: 0.2.0
         Environment: Linux
            Reporter: Kouhei Sutou

arrow::io::ReadWriteFileInterface inheritances arrow::io::FileInterface
as diamond style via:

  * ReadableFileInterface -> InputStream -> FileInterface
  * WriteableFileInterface -> OutputStream -> FileInterface

If we have diamond inheritance, we can't cast subclasses of
arrow::io::ReadWriteFileInterface such as arrow::io::MemoryMappedFile to


    #include <arrow/io/file.h>

      std::shared_ptr<arrow::io::MemoryMappedFile> memory_mapped_file;

      std::shared_ptr<arrow::io::FileInterface> file = memory_mapped_file;

      return 0;

Build result: In function 'int main()': error: conversion from 'std::shared_ptr<arrow::io::MemoryMappedFile>'
to non-scalar type 'std::shared_ptr<arrow::io::FileInterface>' requested
       std::shared_ptr<arrow::io::FileInterface> file = memory_mapped_file;

We can resolve it by using virtual inheritance.

This message was sent by Atlassian JIRA

View raw message