Copyright 2019 The Go Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Package mapsort provides sorted access to maps.
package mapsort

import (
	

	
)
Range iterates over every map entry in sorted key order, calling f for each key and value encountered.
func ( protoreflect.Map,  protoreflect.Kind,  func(protoreflect.MapKey, protoreflect.Value) bool) {
	var  []protoreflect.MapKey
	.Range(func( protoreflect.MapKey,  protoreflect.Value) bool {
		 = append(, )
		return true
	})
	sort.Slice(, func(,  int) bool {
		switch  {
		case protoreflect.BoolKind:
			return ![].Bool() && [].Bool()
		case protoreflect.Int32Kind, protoreflect.Sint32Kind, protoreflect.Sfixed32Kind,
			protoreflect.Int64Kind, protoreflect.Sint64Kind, protoreflect.Sfixed64Kind:
			return [].Int() < [].Int()
		case protoreflect.Uint32Kind, protoreflect.Fixed32Kind,
			protoreflect.Uint64Kind, protoreflect.Fixed64Kind:
			return [].Uint() < [].Uint()
		case protoreflect.StringKind:
			return [].String() < [].String()
		default:
			panic("invalid kind: " + .String())
		}
	})
	for ,  := range  {
		if !(, .Get()) {
			break
		}
	}