Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for canRangeFunc2 (0.15 sec)

  1. src/reflect/iter.go

    // If v's kind is Pointer, the pointer element type must have kind Array.
    // Otherwise v's kind must be Array, Map, Slice, or String.
    func (v Value) Seq2() iter.Seq2[Value, Value] {
    	if canRangeFunc2(v.typ()) {
    		return func(yield func(Value, Value) bool) {
    			rf := MakeFunc(v.Type().In(0), func(in []Value) []Value {
    				return []Value{ValueOf(yield(in[0], in[1]))}
    			})
    			v.Call([]Value{rf})
    		}
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 22 13:40:11 UTC 2024
    - 3.9K bytes
    - Viewed (0)
  2. src/reflect/type.go

    }
    
    func (t *rtype) CanSeq2() bool {
    	switch t.Kind() {
    	case Array, Slice, String, Map:
    		return true
    	case Func:
    		return canRangeFunc2(&t.t)
    	case Pointer:
    		return t.Elem().Kind() == Array
    	}
    	return false
    }
    
    func canRangeFunc2(t *abi.Type) bool {
    	if t.Kind() != abi.Func {
    		return false
    	}
    	f := t.FuncType()
    	if f.InCount != 1 || f.OutCount != 0 {
    		return false
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 29 17:58:53 UTC 2024
    - 85.5K bytes
    - Viewed (0)
Back to top