これは、ジェネリック ベクトルとペア タイプ、テンプレート オブ テンプレートを使用したペアのベクトルのフォローアップです。
(Pair of x,y) のテンプレート引数が指定されている間に、std::vector
またはを使用してメソッドを呼び出せるようにしたいと考えています。stxxl:vector
vector
具体的には、signatrue メソッドは次のようになります。
template<typename t_x, typename t_y,
template<typename, typename> class t_pair,
template<typename...> class t_vector>
method(t_vector<t_pair<t_x,t_y>> &v)
残念ながら、このように署名を指定する場合、stxxl:vector
asを渡すことはできませんt_vector
。これにより、次のコンパイル エラーが発生します。
sad.hpp:128:5: note: template argument deduction/substitution failed:
program.cpp:104:52: error: type/value mismatch at argument 1 in template parameter list for ‘template<class ...> class t_vector’
method(coordinates);
^
program.cpp:104:52: error: expected a type, got ‘4u’
program.cpp:104:52: error: type/value mismatch at argument 1 in template parameter list for ‘template<class ...> class t_vector’
program.cpp:104:52: error: expected a type, got ‘2097152u’
問題は、 ?stxxl::vector
を使用して既存のコードのドロップイン置換として使用できるようにするために、メソッド シグネチャを変更する方法です。std::vector
ベクトルにネストされたテンプレートを使用している理由の更新: 間違っているかもしれませんが、前述の方法で変数を型指定するコンパイラが必要です。
たとえば、vector
またはを構築していますqueue
std::vector<t_x> intervals(k * k + 1);
typedef std::tuple<std::pair<t_x,t_y>,std::pair<t_x,t_y>, std::pair<t_x,t_y>, uint> t_queue;
std::queue <t_queue> queue;
ペア uint32_t or uint64_t
要素のタイプがuint32_t or uint64_t