[ 
https://issues.apache.org/jira/browse/ARROW-486?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17657520#comment-17657520
 ] 

Rok Mihevc commented on ARROW-486:
----------------------------------

This issue has been migrated to [issue 
#16129|https://github.com/apache/arrow/issues/16129] on GitHub. Please see the 
[migration documentation|https://github.com/apache/arrow/issues/14542] for 
further details.

> [C++] arrow::io::MemoryMappedFile can't be casted to arrow::io::FileInterface
> -----------------------------------------------------------------------------
>
>                 Key: ARROW-486
>                 URL: https://issues.apache.org/jira/browse/ARROW-486
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: C++
>    Affects Versions: 0.2.0
>         Environment: Linux
>            Reporter: Kouhei Sutou
>            Assignee: Kouhei Sutou
>            Priority: Major
>             Fix For: 0.2.0
>
>
> 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
> arrow::io::FileInterface.
> C++:
>     #include <arrow/io/file.h>
>     int
>     main(void)
>     {
>       std::shared_ptr<arrow::io::MemoryMappedFile> memory_mapped_file;
>       std::shared_ptr<arrow::io::FileInterface> file = memory_mapped_file;
>       return 0;
>     }
> Build result:
>     a.cc: In function 'int main()':
>     a.cc:8:52: 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
(v8.20.10#820010)

Reply via email to