2011-04-15 118 views
0

我有一個結構,擴展一個抽象類,然後我添加一個boost multi_array裏面作爲變量,我得到以下錯誤。實例化結構與提升multi_array

struct myrunnablestruct : zi::runnable{ 
    boost::multi_array<int,3> myArray; 
    myrunnablestruct(unsigned int dimensions) 
     : myArray(boost::extents[ dimensions ][ dimensions ][ dimensions ]) 
    { } 
} 

int main(){ 
    myrunnablestruct mrs(8); 
} 

error: cannot declare variable ' mrs ' to be of abstract type because the following virtual functions are pure within zi::concurrency::runnable

回答

0

的誤差unreleated到boost::multi_array<>

zi::runnable擁有純粹的虛擬成員函數,你的結構沒有實現,並且不可能用純虛擬成員函數實例化一個類型。假設錯誤信息告訴你需要實現哪些成員函數,但是你沒有在你的問題中粘貼錯誤信息的那部分。

+0

謝謝你是對的,它是void run() – h1vpdata 2011-04-15 06:42:26

+0

@Be.The.Water:那麼你去 - 'myrunnablestruct'需要提供'void run()'的實現。 – ildjarn 2011-04-15 06:43:29