
13 Mar
2010
13 Mar
'10
3:26 p.m.
Steven Watanabe
AMDG
Cuneyt Taskiran wrote:
The interprocess document gives the prototype for `construct()` as
MyType *ptr = managed_memory_segment.construct<MyType>("Name") (par1, par2...); but when I try
MyVector *myvector = segment.construct<MyVector>("MyVector")(100, alloc_inst); I get compilation errors.
This is because vector doesn't have such a constructor. Try (100, 0, alloc_inst)
In Christ, Steven Watanabe
Works like a charm, thanks a lot! I checked std::vector doc and saw that it's constructor is explicit vector ( size_type n, const T& value= T(), const Allocator& = Allocator() ); so you're right. Stupid question: if this is the constructor, how does std::vector<int> v = std::vector<int>(100) work? Thanks a lot, C