1#!/usr/bin/python3 2 3# Copyright 2020 Google LLC 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# https://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16 17# Generator for emboss_arithmetic_all_known_generated.h. 18 19# Maximum number of explicit arguments in the recursive overloads. This script 20# will generate overloads for 1...OVERLOADS-1 arguments, plus a special overload 21# that handles >=OVERLOADS arguments using a variadic template. 22OVERLOADS = 64 23 24# Copyright header in the generated code complies with Google policies. 25print("""// Copyright 2020 Google LLC 26// 27// Licensed under the Apache License, Version 2.0 (the "License"); 28// you may not use this file except in compliance with the License. 29// You may obtain a copy of the License at 30// 31// https://www.apache.org/licenses/LICENSE-2.0 32// 33// Unless required by applicable law or agreed to in writing, software 34// distributed under the License is distributed on an "AS IS" BASIS, 35// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 36// See the License for the specific language governing permissions and 37// limitations under the License. 38 39// GENERATED CODE. DO NOT EDIT. REGENERATE WITH 40// runtime/cpp/generators/all_known.py""") 41 42for i in range(1, OVERLOADS + 1): 43 print(""" 44template <{}> 45inline constexpr bool AllKnown({}) {{ 46 return {}; 47}}""".format( 48 ", ".join(["typename T{}".format(n) for n in range(i)] + 49 (["typename... RestT"] if i == OVERLOADS else [])), 50 ", ".join(["T{} v{}".format(n, n) for n in range(i)] + 51 (["RestT... rest"] if i == OVERLOADS else [])), 52 " && ".join(["v{}.Known()".format(n) for n in range(i)] + 53 (["AllKnown(rest...)"] if i == OVERLOADS else [])))) 54 55