func (s *IPSetBuilder) Clone() *IPSetBuilder {
	return &IPSetBuilder{
		in:  append([]IPRange(nil), s.in...),
		out: append([]IPRange(nil), s.out...),
	}
}
Clone returns a copy of s that shares no memory with s.
package netaddr
import (
	"fmt"
	"runtime"
	"sort"
	"strings"
)
type IPSetBuilder struct {
	in []IPRange
	out []IPRange
	errs multiErr
}
func (s *IPSetBuilder) normalize() {
	const debug = false
	if debug {
		debugf("ranges start in=%v out=%v", s.in, s.out)
	}
	in, ok := mergeIPRanges(s.in)
	if !ok {
		return
	}
	out, ok := mergeIPRanges(s.out)
	if !ok {
		return
	}
	if debug {
		debugf("ranges sort  in=%v out=%v", in, out)
	}
	min := make([]IPRange, 0, len(in))
	for len(in) > 0 && len(out) > 0 {
		rin, rout := in[0], out[0]
		if debug {
			debugf("step in=%v out=%v", rin, rout)
		}
		switch {
		case !rout.IsValid() || !rin.IsValid():
			panic("invalid IPRanges during Ranges merge")
		case rout.entirelyBefore(rin):
			out = out[1:]
			if debug {
				debugf("out before in; drop out")
			}
		case rin.entirelyBefore(rout):
			min = append(min, rin)
			in = in[1:]
			if debug {
				debugf("in before out; append in")
				debugf("min=%v", min)
			}
		case rin.coveredBy(rout):
			in = in[1:]
			if debug {
				debugf("in inside out; drop in")
			}
		case rout.inMiddleOf(rin):
			min = append(min, IPRange{from: rin.from, to: rout.from.Prior()})
			in[0].from = rout.to.Next()
			out = out[1:]
			if debug {
				debugf("out inside in; split in, append first in, drop out, adjust second in")
				debugf("min=%v", min)
			}
		case rout.overlapsStartOf(rin):
			in[0].from = rout.to.Next()
			out = out[1:]
			if debug {
				debugf("out cuts start of in; adjust in, drop out")
			}
		case rout.overlapsEndOf(rin):
			min = append(min, IPRange{from: rin.from, to: rout.from.Prior()})
			in = in[1:]
			if debug {
				debugf("merge out cuts end of in; append shortened in")
				debugf("min=%v", min)
			}
		default:
			panic("unexpected additional overlap scenario")
		}
	}
	if len(in) > 0 {
		min = append(min, in...)
		if debug {
			debugf("min=%v", min)
		}
	}
	s.in = min
	s.out = nil
}