Possibly too newbie a question?
I haven't received any response to my question. If this is is not the appropriate forum I would appreciate some suggestions as to where to ask the question. I have gone over the mailing list groups page and this seems to be the place to ask it but I could be wrong.
I am stepping through interprocess shared memory code and I was a little confused by the offset_ptr code that I was hitting*. I cannot figure out how that is specified to the template of rbtree_best_fit. I see in boost/interprocess/interprocess_fwd.hpp the declaration of managed_shared_memory by typedef'ing basic_managed_shared_memory with rbtree_best_fit
On Tue, Mar 16, 2010 at 5:44 PM, Eric Whitcombe
I haven't received any response to my question. If this is is not the appropriate forum I would appreciate some suggestions as to where to ask the question. I have gone over the mailing list groups page and this seems to be the place to ask it but I could be wrong.
I am stepping through interprocess shared memory code and I was a little confused by the offset_ptr code that I was hitting*. I cannot figure out how that is specified to the template of rbtree_best_fit. I see in boost/interprocess/interprocess_fwd.hpp the declaration of managed_shared_memory by typedef'ing basic_managed_shared_memory with rbtree_best_fit
as the *AllocationAlgorithm* argument but I can't figure out how offset_ptr is is supplied as the *VoidPointer*argument to the rbtree_best_fit template. That template has 3 arguments but the forward declaration only provides one. Are the other two somehow inferred? If so, how? * I have looked at the documentation for interprocess - including the explanation of offset_ptr. I understand the need for it. I just don't see how it is incorporated into the rbtree_best_fit template.
Hi Eric - I don't have the knowledge to answer your question I'm afraid, but as a general comment your question is too vague and general. You might get a better response by composing the shortest example bit of code that demonstrates your point, and then asking why line 'X' doesn't work/compile or whatever. It's generally easier to answer highly specific questions rather than general ones, and then you have to do the generalisation. Hope that helps a little. Regards, Rob.
Robert,
Thanks for the reply, however it's not that something is not working. I am just trying to understand boost and how it works as a personal professional development exercise. It just happens to be that I am looking at interprocess - I could have started looking at something else but it relates to some coding I have done myself. I suppose it is a general question about advanced template programming and I think it is a valid one for this group. But I am certainly open to a better suggestion for where I can get the information I seek.
----- Original Message -----
From: Robert Jones
To: boost-users@lists.boost.org
Sent: Tuesday, March 16, 2010 5:32 PM
Subject: Re: [Boost-users] Possibly too newbie a question?
On Tue, Mar 16, 2010 at 5:44 PM, Eric Whitcombe
Eric Whitcombe wrote:
I am stepping through interprocess shared memory code and I was a little confused by the offset_ptr code that I was hitting*. I cannot figure out how that is specified to the template of rbtree_best_fit. I see in boost/interprocess/interprocess_fwd.hpp the declaration of managed_shared_memory by typedef'ing basic_managed_shared_memory with rbtree_best_fit
as the AllocationAlgorithm argument but I can't figure out how offset_ptr is is supplied as the VoidPointer >>> argument to the rbtree_best_fit template. That template has 3 arguments but the forward declaration only provides one. Are the other two somehow inferred? If so, how?
rbtree_best_fit
Thanks I just stumbled on that earlier today. It confounds me that the
parameter is renamed from VoidPointer to VoidMutex ???!!!
that is basically how I missed it. I thought there was some inscurtable
argument deduction going on.
Thanks so much Gevorg.
----- Original Message -----
From: "Gevorg Voskanyan"
Eric Whitcombe wrote:
I am stepping through interprocess shared memory code and I was a little confused by the offset_ptr code that I was hitting*. I cannot figure out how that is specified to the template of rbtree_best_fit. I see in boost/interprocess/interprocess_fwd.hpp the declaration of managed_shared_memory by typedef'ing basic_managed_shared_memory with rbtree_best_fit
as the AllocationAlgorithm argument but I can't figure out how offset_ptr is is supplied as the VoidPointer >>> argument to the rbtree_best_fit template. That template has 3 arguments but the forward declaration only provides one. Are the other two somehow inferred? If so, how? rbtree_best_fit
works because rbtree_best_fit class template's declaration specifies default arguments for VoidMutex and MemAlignment template parameters, shown here: template class rbtree_best_fit; So rbtree_best_fit
is equivalent to rbtree_best_fit Does that answer your question, or have I misunderstood it?
HTH, Gevorg _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Thanks I just stumbled on that earlier today. It confounds me that the parameter is renamed from VoidPointer to VoidMutex ???!!!
Eric Whitcombe wrote: that is basically how
I missed it. I thought there was some inscurtable argument deduction going on.
Eric, Well, I don't see the parameter renaming you mentioned. In fact, the only place I see "VoidPointer" identifier used in interprocess_fwd.hpp is on line 394 in declaration of intrusive_ptr class template, which is unrelated... This is from a very recent boost trunk. Best Regards, Gevorg
I am using 1.42.0--
The declaration of rbtree_best_fit in rbtree_best_fit.hpp at line 58 looks
like:
template
Thanks I just stumbled on that earlier today. It confounds me that the parameter is renamed from VoidPointer to VoidMutex ???!!!
Eric Whitcombe wrote: that is basically how
I missed it. I thought there was some inscurtable argument deduction going on.
Eric,
Well, I don't see the parameter renaming you mentioned. In fact, the only place I see "VoidPointer" identifier used in interprocess_fwd.hpp is on line 394 in declaration of intrusive_ptr class template, which is unrelated... This is from a very recent boost trunk.
Best Regards, Gevorg _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Eric Whitcombe wrote:
I am using 1.42.0-- The declaration of rbtree_best_fit in rbtree_best_fit.hpp at line 58 looks like:
template
class rbtree_best_fit
The VoidPointer parameter name is what is used throughout the class implementation.
The forward declarationy ou pointed out in interprocess_fwd.hpp at line 166 looks like:
template
class rbtree_best_fit;
The VoidMutex there is weird. The same thing occurs in 1.35.0 and 1.36.0 -- the only other version I happen to have.
Ah, I see. This looks like a typo at interprocess_fwd.hpp:166 indeed - the name for the second template parameter should have been spelled VoidPointer instead of VoidMutex. Nevertheless, the names of template parameters are irrelevant unless they are referred to in that same template declaration/definition. The forward declaration of rbtree_best_fit could have just been written as template < class, class = offset_ptr<void>, std::size_t = 0 > class rbtree_best_fit; as far as the compiler is concerned. So the (non-intentional) mismatch of parameter names observed here does not prevent the compiler to use the default template arguments correctly, and causes absolutely no confusion for the compiler - only for us human beings :) Gevorg
participants (3)
-
Eric Whitcombe
-
Gevorg Voskanyan
-
Robert Jones