1
指定された列挙テンプレートパラメータ(store_type)に基づいてクラステンプレートを選択しようとしています。今、私はこれを使用するクラスをインスタンス化しますが、このクラスのbasic_storeをインスタンス化しようとするようです。enumテンプレートパラメータによるコンパイル時間クラステンプレート選択
enum store_type
{
none,
basic,
lockless,
};
template<class T, store_type S = none, typename = void>
struct get_store_type
{
};
template<class T>
struct get_store_type<T, basic,
typename std::enable_if<!std::is_abstract<T>::value>::type>
{
using store_type = typename basic_store<T>;
};
template<class T>
struct get_store_type<T, lockless>
{
using store_type = typename lockless_store<T>;
};
template<typename T, store_type S>
class client
{
public:
using my_store_type = typename get_store_type<T, S>::store_type;
}
//Tries to instantiate a basic store... which is not allowed.
client<SomeAbstractType, lockless> something;
勿論!ありがとう、年齢のためにこれを見つめていた:P。 –
@AndreasLoanjoe大歓迎です。 – Rabbid76
私はそれをどのように受け入れるのですか?私はそれをupvoteする必要がありますか?私がしたから。編集:nvmはそれが受け入れられたそれを得た! –