English 中文(简体)
A. 创造促进共同点的媒介
原标题:Creating a vector of boost shared pointers

I have reached a problem and was wondering if someone could help me please.

在我的一个班级(例如班级1) 我

typef 强化:共享——吸收与设计;

typef st;

In another class (e.g. class2) I need to create a vector of this again, in order to iterate through this

因此,我试图做到以下几点:

class1::ImportTableObject& table = configPtr->getTable();    
std::vector<class1::class-one-object>::const_iterator* iter = table.begin();

这造成了以下汇编错误:

cannot convret `__gnu_cxx::__normal_iterator<boost::shared_ptr<class1::class-one-object>*, std::vector<boost::shared_ptr<class1::class-one-object>,
 std::alloctor<boost::shared_ptr<class1::class-one-object> > > to  __gnu_cxx::__normal_iterator<const class1::class-one-object*, std::vector<class1::class-one-object>

等等

谁能帮助我?

事先感谢你

最佳回答

它不把点人送回探测器,而是把电梯送回。

std::vector<class1::class-one-object>::const_iterator iter = table.begin()

.。

问题回答

从错误信息来看,人们可以得出结论,你基本上将集装箱混合在一起:一个装有共用点的人,一个是同级物体,第二个是含有一门目标。 它希望这样做:

std::vector<boost::shared_ptr<class1::class-one-object> >::const_iterator iter = table.begin();

但你可能希望取得这样的成就:

std::vector<class1::class-one-object> vec;
const class1::class-one-object* ptr = (*iter).get();
if (ptr)
    vec.push_back(*ptr);

最好。





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?