Boost :: Interprocessを使用しようとしていますが、gcc 4.1.2でコンパイルしようとするとコンパイラエラーが発生します。コードを絞り込み、問題を再現せずに再現することができました。コードは次のとおりです。gccでブーストプロセスが失敗しました。4.12
#include <iostream>
static const std::size_t offset_type_alignment = 0;
template<class T, class U>
struct pointer_to_other;
template<class T, class U, template<class> class Sp>
struct pointer_to_other< Sp<T>, U >
/*144*/{
typedef Sp<U> type;
};
template <class PointedType, class DifferenceType, class OffsetType, std::size_t OffsetAlignment>
class offset_ptr
{
};
template <class T, class DifferenceType = std::ptrdiff_t, class OffsetType = std::size_t, std::size_t Alignment = offset_type_alignment>
class offset_ptr;
template<class T, class T2, class T3, std::size_t A, class U>
/*158*/struct pointer_to_other<offset_ptr<T, T2, T3, A>, U >
{
typedef offset_ptr<U, T2, T3, A> type;
};
template<class VoidPointer>
class message_queue_t
{
typedef VoidPointer void_pointer;
/*167*/ typedef typename pointer_to_other<void_pointer, char>::type char_ptr;
};
int main()
{
/*177*/ message_queue_t< offset_ptr<void, std::ptrdiff_t, std::size_t, offset_type_alignment> > test;
}
私が取得エラー:MSVSで
.cc: In instantiation of message_queue_t >
.cc:177: instantiated from here
.cc:167: error: ambiguous class template instantiation for struct pointer_to_other, char>
.cc:144: error: candidates are: struct pointer_to_other, U>
.cc:158: error: struct pointer_to_other, U>
.cc:167: error: invalid use of undefined type âstruct pointer_to_other, char>
.cc:140: error: declaration of âstruct pointer_to_other, char>â
を、これは罰金コンパイルします。 Ideoneもコンパイルされますが、gcc 4.3.4が使用されます。コンパイラを変更
は重要
- 私が知っている
- 問題外であるブースト::私が探しています何
プロセス間でのgccのこのバージョンでテストされていませんforは回避策です。何か案は?
PS - テンプレートはブーストの一部ですが、縮小されているため、実際には変更できません。私が変更できる方法はありますか:
message_queue_t< offset_ptr<void, std::ptrdiff_t, std::size_t, offset_type_alignment> > test;
これを機能させるには?
この制限を確認するソースを追加してください。 – nikhil
@nikhil whoaこれは1年以上前だったので、私が尋ねていたことはほとんど思いつかなかった。 –
ああ、私は似たような問題で噛まれました。 – nikhil