in.go 550 B

12345678910111213
  1. package cc
  2. const inTpl = `{{ $f := .Field -}}{{ $r := .Rules -}}
  3. {{- if $r.In }}
  4. if ({{ lookup $f "InLookup" }}.find(static_cast<decltype({{ lookup $f "InLookup" }})::key_type>({{ accessor . }})) == {{ lookup $f "InLookup" }}.end()) {
  5. {{ err . "value must be in list " $r.In }}
  6. }
  7. {{- else if $r.NotIn }}
  8. if ({{ lookup $f "NotInLookup" }}.find(static_cast<decltype({{ lookup $f "NotInLookup" }})::key_type>({{ accessor . }})) != {{ lookup $f "NotInLookup" }}.end()) {
  9. {{ err . "value must not be in list " $r.NotIn }}
  10. }
  11. {{- end }}
  12. `