hi Rares, I agree this is a rough edge. I opened https://issues.apache.org/jira/browse/ARROW-2184 so we can review and be more consistent about using the base interfaces
For your use case I would recommend doing std::shared_ptr<FileOutputStream> tmp; RETURN_NOT_OK(FileOutputStream::Open(file_name, &tmp)); f = tmp; - Wes On Mon, Feb 19, 2018 at 6:54 PM, Rares Vernica <rvern...@gmail.com> wrote: > Hi, > > This might be more a C++ question, but I'm trying to have one variable > store the output stream for both StdoutStream and FileOutputStream. I do > this: > > shared_ptr<OutputStream> f; > if (fn == "stdout") > f.reset(new StdoutStream()); > else > FileOutputStream::Open(fn, false, &f); > > As is, the code does not work because Open expects > shared_ptr<FileOutputStream>. If I do a cast: > > FileOutputStream::Open(fn, false, > &(dynamic_pointer_cast<FileOutputStream>(f))); > > I get an error: taking address of temporary [-fpermissive] > > What would be a good way of having one variable for both branches of the if > statement? > > Thanks! > Rares