Boost logo

Boost Users :

Subject: Re: [Boost-users] Possibly too newbie a question?
From: Gevorg Voskanyan (v_gevorg_at_[hidden])
Date: 2010-03-20 09:38:29


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 MutexFamily, class VoidPointer, std::size_t MemAlignment>
> 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 MutexFamily, class VoidMutex =
> offset_ptr<void>, std::size_t MemAlignment = 0>
> 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


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net