mirror of
				https://github.com/gonum/gonum.git
				synced 2025-10-31 02:26:59 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			37 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			37 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| // Copyright ©2014 The Gonum Authors. All rights reserved.
 | |
| // Use of this source code is governed by a BSD-style
 | |
| // license that can be found in the LICENSE file.
 | |
| 
 | |
| // +build appengine safe
 | |
| 
 | |
| package set
 | |
| 
 | |
| import "reflect"
 | |
| 
 | |
| // same determines whether two sets are backed by the same store. In the
 | |
| // current implementation using hash maps it makes use of the fact that
 | |
| // hash maps are passed as a pointer to a runtime Hmap struct. A map is
 | |
| // not seen by the runtime as a pointer though, so we use reflect to get
 | |
| // the maps' pointer values to compare.
 | |
| func same(a, b Nodes) bool {
 | |
| 	return reflect.ValueOf(a).Pointer() == reflect.ValueOf(b).Pointer()
 | |
| }
 | |
| 
 | |
| // intsSame determines whether two sets are backed by the same store. In the
 | |
| // current implementation using hash maps it makes use of the fact that
 | |
| // hash maps are passed as a pointer to a runtime Hmap struct. A map is
 | |
| // not seen by the runtime as a pointer though, so we use reflect to get
 | |
| // the maps' pointer values to compare.
 | |
| func intsSame(a, b Ints) bool {
 | |
| 	return reflect.ValueOf(a).Pointer() == reflect.ValueOf(b).Pointer()
 | |
| }
 | |
| 
 | |
| // int64sSame determines whether two sets are backed by the same store. In the
 | |
| // current implementation using hash maps it makes use of the fact that
 | |
| // hash maps are passed as a pointer to a runtime Hmap struct. A map is
 | |
| // not seen by the runtime as a pointer though, so we use reflect to get
 | |
| // the maps' pointer values to compare.
 | |
| func int64sSame(a, b Int64s) bool {
 | |
| 	return reflect.ValueOf(a).Pointer() == reflect.ValueOf(b).Pointer()
 | |
| }
 | 
