0
時的循環性我想這樣做一個類,其中包含NBT格式指定的任意值。它是一種json,但更先進。使用基數和派生類作爲數組在
因此,我創建了一個包含ListValue(無名稱的值)和另一個包含Value(帶名稱)的類。在派生類,我擡離基部
using ListValue::operator=;
在第三文件=操作我有兩個usings:
using CompoundData = std::vector<Value>;
using ListData = std::vector<ListValue>;
ListValue具有私有成員爲:
union ValueHolder
{
Byte vByte;
Short vShort;
Int vInt;
Long vLong;
Float vFloat;
Double vDouble;
String* pString;
CompoundData* pCompound;
} mData;
(I以後會添加ListData *)
問題是我完全不知道如何包含所有這些標頭s o它將與循環一起工作。我嘗試了幾個前向聲明和容器作爲向量或向量,並帶有智能指針來打破它,但是沒有爲我工作。
如果您能幫助我爲我的代碼提供一個想法/解決方案,我將非常感激。非常感謝你。
你應該嘗試創建一個重現你的問題的最小例子。編譯器消息通常是一個很好的起點。 –
從設計上的錯誤幾乎總是出現循環性......將設計更改爲沒有循環性,將來會爲您節省很多麻煩。你有很多選擇來實現這一點,首先我想到的是多態性 – Garf365
什麼是NBT格式?另外,爲什麼你的類型會受到欺騙?一個錯字? –