By the way, what happens to the old data I used with the previous make 
command?

On Tuesday, January 10, 2017 at 1:49:37 AM UTC+2, kortschak wrote:
>
> On Mon, 2017-01-09 at 15:12 -0800, Tomi Häsä wrote: 
> > Is this the correct way of resetting a slice? I mean do I always need 
> > to  
> > use make to reset a slice? 
> > 
> >     // initialize slice 
> > 
> >     onearea Area = Area{} 
> > 
> >     group []Area = make( []Area, 0, MAX ) 
> > 
> >     // add stuff to slice 
> > 
> >     group = append( group, onearea ) 
> > 
> >     // reset slice 
> > 
> >     group = make( []Area, 0, MAX ) 
>
>
> group = group[:0] 
>
>
> > Using nil to reset a slice doesn't seem to be wise as the capacity 
> > does not  
> > stay with MAX, but it will decrease to 2 in my program. 
> > 
> >     group = nil 
> > 
> > Full code here: https://github.com/tomihasa/unicodetest 
> >  
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to