samedi 27 mai 2017

std shared_pointer_cast not defined

I am trying a sample example noted down in apache arrow C++ example. The example uses shared pointed cast as below (code snippet)

Version

g++ (Ubuntu 4.8.4-2ubuntu1~14.04.3aka8.0.2) 4.8.4
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Code

int main()
{
        Int64Builder builder(arrow::default_memory_pool(), arrow::int64());
        builder.Append(8);

        std::shared_ptr<Array> array;
        builder.Finish(&array);

        std::shared_ptr<Int64Array> int64_array = std::shared_pointer_cast<Int64Array>(array);


        return 0;
}

Compilation Flags

However, when I compile the code with below flags, I get undefined error.

g++ example.cpp -O2 -std=c++11 -I/workspace/arrow/arrow-master/cpp/src  -L/workspace/arrow/arrow-master/cpp/release/release  -larrow -larrow_jemalloc  

Error

example.cpp: In function 'int main()':
example.cpp:24:44: error: 'shared_pointer_cast' is not a member of 'std'
  std::shared_ptr<Int64Array> int64_array = std::shared_pointer_cast<Int64Array>(array);
                                            ^
example.cpp:24:79: error: expected primary-expression before '>' token
  std::shared_ptr<Int64Array> int64_array = std::shared_pointer_cast<Int64Array>(array);

I do not see any documentation for std::shared_pointer_cast

Question

  1. Am I missing something, is this compilable code in c++11 version?
  2. What are the alternative in C++11 version for this?

Aucun commentaire:

Enregistrer un commentaire