私は、apacheの矢印C++ exampleに記載されているサンプルサンプルを試しています。私はcompilときの例では、共有使用し は、std shared_pointer_castが定義されていません
しかし(コードスニペット)
バージョン
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.
コード
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;
}
コンパイルフラグ以下のようにキャスト尖った私は未定義のエラーを取得します。
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
エラー
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);
私は質問
- 私が何かをしないのですが、C言語+でこのコンパイルコードです
std::shared_pointer_cast
のための任意のドキュメントを参照してくださいしないでください+11バージョン?
- これはC++ 11バージョンの代替手段は何ですか?
この例は、[std :: static_pointer_cast'](http://en.cppreference.com/w/cpp/memory/shared_ptr/pointer_cast)を意味する可能性があります –
http://en.cppreference.com/w/cpp/memory/shared_ptr/pointer_cast – songyuanyao
@songyuanyao:引用されたリンクにshared_pointer_castへの参照がありません。この例はstatic_pointer_castを引用していないことに注意してください。 –