Boost logo

Boost Users :

From: Peter Barker (newbarker_at_[hidden])
Date: 2008-08-21 06:02:30


--- On Wed, 20/8/08, Daryle Walker <darylew_at_[hidden]> wrote:

> From: Daryle Walker <darylew_at_[hidden]>
> Subject: Re: [Boost-users] Implementation question about boost::circular_buffer and allocator
> To: boost-users_at_[hidden]
> Date: Wednesday, 20 August, 2008, 10:37 PM
> On Aug 20, 2008, at 10:42 AM, Peter Barker wrote:
>
> > I've been going through the Boost libraries and
> encountered
> > boost::circular_buffer. My question is not with the
> operation of
> > Boost.Circular Buffer as-such, but about how the
> instantiation of
> > it works without specifying the allocator.
> >
> > The introductory example in the
> documentation(http://www.boost.org/
> > doc/libs/1_35_0/libs/circular_buffer/doc/
> > circular_buffer.html#briefexample) contains the
> following line:
> >
> > // Create a circular buffer with a capacity for 3
> integers.
> > boost::circular_buffer<int> cb(3);
> >
> > But looking at the header file base.hpp in the
> circular_buffer
> > directory, we have the following:
> >
> > template <class T, class Alloc>
> > class circular_buffer
> > {
> > ......
> >
> > };
> >
> > The Alloc template parameter is not a default one, so
> I can't
> > understand how we can instantiate cb in the example?
> >
> > Apologies if this is not strictly boost-user related.
>
>
> A forward declaration can provide defaults for template
> parameters.
> This is what is being done here, the main header is
> "boost/
> circular_buffer.hpp" and its forward declaration, with
> default
> allocator, is at "boost/circular_buffer_fwd.hpp".
>
> --
> Daryle Walker
> Mac, Internet, and Video Game Junkie
> darylew AT hotmail DOT com
>
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users

Daryle,

Thank you very much - That was driving me crazy!


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