diff --git a/CMakeLists.txt b/CMakeLists.txt index ecfc9ba..fb9f575 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.20) include(cmake/color.cmake) -set(BLT_VERSION 0.21.4) +set(BLT_VERSION 0.21.5) set(BLT_TEST_VERSION 0.0.1) set(BLT_TARGET BLT) diff --git a/commit.py b/commit.py index e8b8443..a940032 100755 --- a/commit.py +++ b/commit.py @@ -1,6 +1,13 @@ #!/usr/bin/python3 import subprocess +import argparse +import sys +import os +import itertools +import requests +import json +from pathlib import Path #--------------------------------------- # CONFIG @@ -8,12 +15,110 @@ import subprocess VERSION_BEGIN_STR = "set(BLT_VERSION " VERSION_END_STR = ")" -PATCH_LIMIT = 1000 #--------------------------------------- # DO NOT TOUCH #--------------------------------------- +USER_HOME = Path.home() +ENVIRONMENT_DATA_LOCATION = USER_HOME / ".brett_scripts.env" + +if sys.platform.startswith("win"): + CONFIG_FILE_DIRECTORY = Path(os.getenv('APPDATA') + "\blt") + CONFIG_FILE_LOCATION = Path(CONFIG_FILE_DIRECTORY + "\commit_config.json") +else: + XDG_CONFIG_HOME = os.environ.get('XDG_CONFIG_HOME') + if XDG_CONFIG_HOME is None: + XDG_CONFIG_HOME = USER_HOME / ".config" + else: + XDG_CONFIG_HOME = Path(XDG_CONFIG_HOME) + + if len(str(XDG_CONFIG_HOME)) == 0: + XDG_CONFIG_HOME = USER_HOME + CONFIG_FILE_DIRECTORY = XDG_CONFIG_HOME / "blt" + CONFIG_FILE_LOCATION = CONFIG_FILE_DIRECTORY / "commit_config.json" + +class Config: + def __init__(self): + # Inline with semantic versioning it doesn't make sense to branch / release on minor + self.branch_on_major = True + self.branch_on_minor = False + self.release_on_major = True + self.release_on_minor = True + self.main_branch = "main" + self.patch_limit = -1 + + def toJSON(self): + return json.dumps(self, default=lambda o: o.__dict__, sort_keys=True, indent=4) + + def fromJSON(file): + with open(file, "r") as f: + j = json.load(f) + obj = Config() + [setattr(obj, key, val) for key, val in j.items() if hasattr(obj, key)] + if obj.branch_on_minor: + obj.branch_on_major = True + return obj + + def from_file(file): + values = {} + if (not os.path.exists(file)): + return Config() + + with open(file, "r") as f: + j = json.load(f) + obj = Config() + [setattr(obj, key, val) for key, val in j.items() if hasattr(obj, key)] + return obj + + def save_to_file(self, file): + dir_index = str(file).rfind("/") + dir = str(file)[:dir_index] + if not os.path.exists(dir): + print(f"Creating config directory {dir}") + os.makedirs(dir) + with open(file, "w") as f: + json.dump(self, f, default=lambda o: o.__dict__, sort_keys=True, indent=4) + + +class EnvData: + def __init__(self, github_username = '', github_token = ''): + self.github_token = github_token + self.github_username = github_username + + def get_env_from_file(file): + f = open(file, "rt") + values = {} + for line in f: + if line.startswith("export"): + content = line.split("=") + for idx, c in enumerate(content): + content[idx] = c.replace("export", "").strip() + values[content[0]] = content[1].replace("\"", "").replace("'", "") + try: + github_token = values["github_token"] + except Exception: + print("Failed to parse github token!") + try: + github_username = values["github_username"] + except: + print("Failed to parse github username! Assuming you are me!") + github_username = "Tri11Paragon" + return EnvData(github_username=github_username, github_token=github_token) + +def open_process(command, print_out = True): + process = subprocess.Popen(command, stderr=subprocess.PIPE, stdout=subprocess.PIPE) + stdout, stderr = process.communicate() + exit_code = process.wait() + str_out = stdout.decode('utf8') + str_err = stderr.decode('utf8') + if print_out and len(str_out) > 0: + print(str_out, end='') + if print_out and len(str_err) > 0: + print(str_err, end='') + #print(stdout, stderr, exit_code) + return (stdout, stderr, exit_code) + def load_cmake(): cmake_file = open("CMakeLists.txt", 'r') cmake_text = cmake_file.read() @@ -38,9 +143,8 @@ def split_version(cmake_text): def recombine(cmake_text, version_parts, begin, end): constructed_version = version_parts[0] + '.' + version_parts[1] + '.' + version_parts[2] constructed_text_begin = cmake_text[0:begin] - constrcuted_text_end = cmake_text[end::] - return constructed_text_begin + constructed_version + constrcuted_text_end - + constructed_text_end = cmake_text[end::] + return constructed_text_begin + constructed_version + constructed_text_end def inc_major(cmake_text): version_parts, begin, end = split_version(cmake_text) @@ -55,32 +159,158 @@ def inc_minor(cmake_text): version_parts[2] = '0' return recombine(cmake_text, version_parts, begin, end) -def inc_patch(cmake_text): +def inc_patch(config: Config, cmake_text): version_parts, begin, end = split_version(cmake_text) - if int(version_parts[2]) + 1 >= PATCH_LIMIT: + if config.patch_limit > 0 and int(version_parts[2]) + 1 >= config.patch_limit: return inc_minor(cmake_text) version_parts[2] = str(int(version_parts[2]) + 1) return recombine(cmake_text, version_parts, begin, end) -cmake_text = load_cmake() -cmake_version = get_version(cmake_text)[0] -print(f"Current Version: {cmake_version}") +def make_branch(config: Config, name): + print(f"Making new branch {name}") + subprocess.call(["git", "checkout", "-b", name]) + subprocess.call(["git", "merge", config.main_branch]) + subprocess.call(["git", "checkout", config.main_branch]) + +def sync_branch(config: Config, version_parts, args): + if config.branch_on_major: + # Branch will be created. + if args.minor: + return; -try: - type = input("What kind of commit is this ((M)ajor, (m)inor, (p)atch)? ") +def make_release(env: EnvData, name): + print(f"Making new release {name}") + repos_v = open_process(["git", "remote", "-v"])[0].splitlines() + urls = [] + for line in repos_v: + origin = ''.join(itertools.takewhile(str.isalpha, line.decode('utf8'))) + urls.append("https://api.github.com/repos/" + open_process(["git", "remote", "get-url", origin], False)[0].decode('utf8').replace("\n", "").replace("https://github.com/", "") + "/releases") + urls = set(urls) + data = { + 'tag_name': name, + 'name': name, + 'body': "Automated Release '" + name + "'", + 'draft': False, + 'prerelease': False + } + headers = { + 'Authorization': f'Bearer {env.github_token}', + 'Accept': 'application/vnd.github+json', + 'X-GitHub-Api-Version': '2022-11-28' + } + for url in urls: + response = requests.post(url, headers=headers, data=json.dumps(data)) + if response.status_code == 201: + print('Release created successfully!') + release_data = response.json() + print(f"Release URL: {release_data['html_url']}") + else: + print(f"Failed to create release: {response.status_code}") + print(response.json()) - if type.startswith('M'): + +def main(): + parser = argparse.ArgumentParser( + prog="Commit Helper", + description="Help you make pretty commits :3") + + parser.add_argument("action", nargs='?', default=None) + parser.add_argument("-p", "--patch", action='store_true', default=False, required=False) + parser.add_argument("-m", "--minor", action='store_true', default=False, required=False) + parser.add_argument("-M", "--major", action='store_true', default=False, required=False) + parser.add_argument('-e', "--env", help="environment file", required=False, default=None) + parser.add_argument('-c', "--config", help="config file", required=False, default=None) + parser.add_argument("--create-default-config", action="store_true", default=False, required=False) + parser.add_argument("--no-release", action="store_true", default=False, required=False) + parser.add_argument("--no-branch", action="store_true", default=False, required=False) + + args = parser.parse_args() + + if args.create_default_config: + config = Config() + config.save_to_file(args.config if args.config is not None else CONFIG_FILE_LOCATION) + return + + if args.env is not None: + env = EnvData.get_env_from_file(args.e) + else: + env = EnvData.get_env_from_file(ENVIRONMENT_DATA_LOCATION) + + if args.config is not None: + config = Config.from_file(args.config) + else: + config = Config.from_file(CONFIG_FILE_LOCATION) + + cmake_text = load_cmake() + cmake_version = get_version(cmake_text)[0] + print(f"Current Version: {cmake_version}") + + if not (args.patch or args.minor or args.major): + try: + if args.action is not None: + type = args.action + else: + type = input("What kind of commit is this ((M)ajor, (m)inor, (p)atch)? ") + + if type.startswith('M'): + args.major = True + elif type.startswith('m'): + args.minor = True + elif type.startswith('p') or type.startswith('P') or len(type) == 0: + args.patch = True + except KeyboardInterrupt: + print("\nCancelling!") + return + + if args.major: print("Selected major") write_cmake(inc_major(cmake_text)) - elif type.startswith('m'): + elif args.minor: print("Selected minor") write_cmake(inc_minor(cmake_text)) - elif type.startswith('p') or type.startswith('P') or len(type) == 0: + elif args.patch: print("Selected patch") - write_cmake(inc_patch(cmake_text)) + write_cmake(inc_patch(config, cmake_text)) subprocess.call(["git", "add", "*"]) subprocess.call(["git", "commit"]) + + cmake_text = load_cmake() + version_parts = split_version(cmake_text)[0] + if args.major: + if config.branch_on_major: + if not args.no_branch: + make_branch(config, "v" + str(version_parts[0])) + + if args.minor: + if config.branch_on_minor: + if not args.no_branch: + make_branch(config, "v" + str(version_parts[0]) + "." + str(version_parts[1])) + elif config.branch_on_major: + subprocess.call(["git", "checkout", "v" + str(version_parts[0])]) + subprocess.call(["git", "rebase", config.main_branch]) + subprocess.call(["git", "checkout", config.main_branch]) + + if args.patch: + if config.branch_on_minor: + subprocess.call(["git", "checkout", "v" + str(version_parts[0]) + "." + str(version_parts[1])]) + subprocess.call(["git", "rebase", config.main_branch]) + subprocess.call(["git", "checkout", config.main_branch]) + elif config.branch_on_major: + subprocess.call(["git", "checkout", "v" + str(version_parts[0])]) + subprocess.call(["git", "rebase", config.main_branch]) + subprocess.call(["git", "checkout", config.main_branch]) + + sync_branch(config=config, version_parts=version_parts, args=args) + subprocess.call(["sh", "-c", "git remote | xargs -L1 git push --all"]) -except KeyboardInterrupt: - print("\nCancelling!") + + if args.major: + if not args.no_release and config.release_on_major: + make_release(env, "v" + str(version_parts[0])) + if args.minor: + if not args.no_release and config.release_on_minor: + make_release(env, "v" + str(version_parts[0]) + "." + str(version_parts[1])) + +if __name__ == "__main__": + main() diff --git a/include/blt/std/iterator.h b/include/blt/std/iterator.h index 5096fa9..ec5e682 100644 --- a/include/blt/std/iterator.h +++ b/include/blt/std/iterator.h @@ -36,6 +36,12 @@ namespace blt template> class enumerator_rev; + template> + class pair_iterator; + + template> + class pair_iterator_rev; + namespace iterator { template> @@ -209,8 +215,7 @@ namespace blt template class pair_wrapper>, - std::void_t - >> : public pair_forward_iterator + std::void_t>> : public pair_forward_iterator { public: using iterator_category = std::forward_iterator_tag; @@ -247,8 +252,7 @@ namespace blt template class pair_wrapper>, - std::void_t - >> : public pair_bidirectional_iterator + std::void_t>> : public pair_bidirectional_iterator { public: using iterator_category = typename blt::meta::lowest_iterator_category::type; @@ -262,17 +266,13 @@ namespace blt /** * Base class for storing begin/end iterators. - * @tparam Iter iterator type. * @tparam IterWrapper wrapper used to iterate * @tparam CompleteClass completed class returned from skip/take methods */ - template + template class iterator_storage_base { public: - explicit iterator_storage_base(Iter begin, Iter end): begin_(std::move(begin)), end_(std::move(end)) - {} - explicit iterator_storage_base(IterWrapper begin, IterWrapper end): begin_(std::move(begin)), end_(std::move(end)) {} @@ -328,18 +328,12 @@ namespace blt * @tparam CompleteClass completed class returned from skip/take methods * @tparam CompleteClassRev reverse version of CompleteClass, returned from rev */ - template - class iterator_storage_reversible : public iterator_storage_base + template + class iterator_storage_reversible : public iterator_storage_base { public: - explicit iterator_storage_reversible(Iter begin, Iter end, blt::size_t container_size): - iterator_storage_base{IterWrapper{enumerate_wrapper{std::move(begin), 0}}, - IterWrapper{enumerate_wrapper{std::move(end), container_size}}} - {} - - explicit iterator_storage_reversible(Iter begin, Iter end, blt::size_t begin_index, blt::size_t end_index): - iterator_storage_base(IterWrapper{enumerate_wrapper{std::move(begin), begin_index}}, - IterWrapper{enumerate_wrapper{std::move(end), end_index}}) + explicit iterator_storage_reversible(IterWrapper begin, IterWrapper end): + iterator_storage_base{std::move(begin), std::move(end)} {} /** @@ -362,11 +356,11 @@ namespace blt * @tparam CompleteClass completed class returned from skip/take methods * @tparam CompleteClassRev reverse version of CompleteClass, returned from rev */ - template - class iterator_storage_random_access : public iterator_storage_reversible + template + class iterator_storage_random_access : public iterator_storage_reversible { public: - using iterator_storage_reversible::iterator_storage_reversible; + using iterator_storage_reversible::iterator_storage_reversible; auto skip(blt::size_t amount) { @@ -392,11 +386,11 @@ namespace blt * @tparam CompleteClass completed class returned from skip/take methods * @tparam CompleteClassRev reverse version of CompleteClass, returned from rev */ - template - class iterator_storage_reversible_rev : public iterator_storage_reversible + template + class iterator_storage_reversible_rev : public iterator_storage_reversible { public: - using iterator_storage_reversible::iterator_storage_reversible; + using iterator_storage_reversible::iterator_storage_reversible; auto rev() const { @@ -439,11 +433,11 @@ namespace blt * @tparam CompleteClass completed class returned from skip/take methods * @tparam CompleteClassRev reverse version of CompleteClass, returned from rev */ - template - class iterator_storage_random_access_rev : public iterator_storage_reversible_rev + template + class iterator_storage_random_access_rev : public iterator_storage_reversible_rev { public: - using iterator_storage_reversible_rev::iterator_storage_reversible_rev; + using iterator_storage_reversible_rev::iterator_storage_reversible_rev; auto skip(blt::size_t amount) { @@ -470,10 +464,20 @@ namespace blt */ template class enumerator, std::void_t>> - : public iterator::iterator_storage_base, enumerator> + : public iterator::iterator_storage_base, enumerator> { public: - using iterator::iterator_storage_base, enumerator>::iterator_storage_base; + explicit enumerator(Iter begin, Iter end, blt::size_t container_size): + iterator::iterator_storage_base, enumerator> + {iterator::enumerate_wrapper{std::move(begin), 0}, + iterator::enumerate_wrapper{std::move(end), container_size}} + {} + + explicit enumerator(Iter begin, Iter end, blt::size_t begin_index, blt::size_t end_index): + iterator::iterator_storage_base, enumerator>{ + iterator::enumerate_wrapper{std::move(begin), begin_index}, + iterator::enumerate_wrapper{std::move(end), end_index}} + {} }; /** @@ -481,10 +485,20 @@ namespace blt */ template class enumerator, std::void_t>> - : public iterator::iterator_storage_reversible, enumerator, enumerator_rev> + : public iterator::iterator_storage_reversible, enumerator, enumerator_rev> { public: - using iterator::iterator_storage_reversible, enumerator, enumerator_rev>::iterator_storage_reversible; + explicit enumerator(Iter begin, Iter end, blt::size_t container_size): + iterator::iterator_storage_reversible, enumerator, enumerator_rev> + {iterator::enumerate_wrapper{std::move(begin), 0}, + iterator::enumerate_wrapper{std::move(end), container_size}} + {} + + explicit enumerator(Iter begin, Iter end, blt::size_t begin_index, blt::size_t end_index): + iterator::iterator_storage_reversible, enumerator, enumerator_rev>{ + iterator::enumerate_wrapper{std::move(begin), begin_index}, + iterator::enumerate_wrapper{std::move(end), end_index}} + {} }; /** @@ -492,10 +506,20 @@ namespace blt */ template class enumerator, std::void_t>> - : public iterator::iterator_storage_random_access, enumerator, enumerator_rev> + : public iterator::iterator_storage_random_access, enumerator, enumerator_rev> { public: - using iterator::iterator_storage_random_access, enumerator, enumerator_rev>::iterator_storage_random_access; + explicit enumerator(Iter begin, Iter end, blt::size_t container_size): + iterator::iterator_storage_random_access, enumerator, enumerator_rev> + {iterator::enumerate_wrapper{std::move(begin), 0}, + iterator::enumerate_wrapper{std::move(end), container_size}} + {} + + explicit enumerator(Iter begin, Iter end, blt::size_t begin_index, blt::size_t end_index): + iterator::iterator_storage_random_access, enumerator, enumerator_rev>{ + iterator::enumerate_wrapper{std::move(begin), begin_index}, + iterator::enumerate_wrapper{std::move(end), end_index}} + {} }; /** @@ -503,10 +527,22 @@ namespace blt */ template class enumerator_rev, std::void_t>> - : public iterator::iterator_storage_reversible_rev>, enumerator, enumerator_rev> + : public iterator::iterator_storage_reversible_rev>, enumerator, enumerator_rev> { public: - using iterator::iterator_storage_reversible_rev>, enumerator, enumerator_rev>::iterator_storage_reversible_rev; + explicit enumerator_rev(Iter begin, Iter end, blt::size_t container_size): + iterator::iterator_storage_reversible_rev>, enumerator, enumerator_rev> + {std::reverse_iterator>{iterator::enumerate_wrapper{std::move(begin), 0}}, + std::reverse_iterator>{ + iterator::enumerate_wrapper{std::move(end), container_size}}} + {} + + explicit enumerator_rev(Iter begin, Iter end, blt::size_t begin_index, blt::size_t end_index): + iterator::iterator_storage_reversible_rev>, enumerator, enumerator_rev>{ + std::reverse_iterator>{ + iterator::enumerate_wrapper{std::move(begin), begin_index}}, + std::reverse_iterator>{iterator::enumerate_wrapper{std::move(end), end_index}}} + {} }; /** @@ -514,10 +550,22 @@ namespace blt */ template class enumerator_rev, std::void_t>> - : public iterator::iterator_storage_random_access_rev>, enumerator, enumerator_rev> + : public iterator::iterator_storage_random_access_rev>, enumerator, enumerator_rev> { public: - using iterator::iterator_storage_random_access_rev>, enumerator, enumerator_rev>::iterator_storage_random_access_rev; + explicit enumerator_rev(Iter begin, Iter end, blt::size_t container_size): + iterator::iterator_storage_random_access_rev>, enumerator, enumerator_rev> + {std::reverse_iterator>{iterator::enumerate_wrapper{std::move(begin), 0}}, + std::reverse_iterator>{ + iterator::enumerate_wrapper{std::move(end), container_size}}} + {} + + explicit enumerator_rev(Iter begin, Iter end, blt::size_t begin_index, blt::size_t end_index): + iterator::iterator_storage_random_access_rev>, enumerator, enumerator_rev>{ + std::reverse_iterator>{ + iterator::enumerate_wrapper{std::move(begin), begin_index}}, + std::reverse_iterator>{iterator::enumerate_wrapper{std::move(end), end_index}}} + {} }; // CTAD for enumerators @@ -531,6 +579,86 @@ namespace blt template enumerator(Iter, Iter, blt::size_t, blt::size_t) -> enumerator; + template + class pair_iterator>, + std::void_t>> + : public iterator::iterator_storage_base, pair_iterator> + { + public: + explicit pair_iterator(Iter1 begin1, Iter1 end1, Iter2 begin2, Iter2 end2): + iterator::iterator_storage_base, pair_iterator> + {iterator::pair_wrapper{std::move(begin1), std::move(begin2)}, + iterator::pair_wrapper{std::move(end1), std::move(end2)}} + {} + }; + + template + class pair_iterator>, + std::void_t>> + : public iterator::iterator_storage_reversible, pair_iterator, pair_iterator_rev> + { + public: + explicit pair_iterator(Iter1 begin1, Iter1 end1, Iter2 begin2, Iter2 end2): + iterator::iterator_storage_reversible, pair_iterator, pair_iterator_rev> + {iterator::pair_wrapper{std::move(begin1), std::move(begin2)}, + iterator::pair_wrapper{std::move(end1), std::move(end2)}} + {} + }; + + template + class pair_iterator>, + std::void_t>> + : public iterator::iterator_storage_random_access, pair_iterator, pair_iterator_rev> + { + public: + explicit pair_iterator(Iter1 begin1, Iter1 end1, Iter2 begin2, Iter2 end2): + iterator::iterator_storage_random_access, pair_iterator, pair_iterator_rev> + {iterator::pair_wrapper{std::move(begin1), std::move(begin2)}, + iterator::pair_wrapper{std::move(end1), std::move(end2)}} + {} + }; + + template + class pair_iterator_rev>, + std::void_t>> + : public iterator::iterator_storage_reversible_rev>, pair_iterator, pair_iterator_rev> + { + public: + explicit pair_iterator_rev(Iter1 begin1, Iter1 end1, Iter2 begin2, Iter2 end2): + iterator::iterator_storage_reversible_rev>, pair_iterator, pair_iterator_rev> + {std::reverse_iterator>{iterator::pair_wrapper{std::move(begin1), std::move(begin2)}}, + std::reverse_iterator>{iterator::pair_wrapper{std::move(end1), std::move(end2)}}} + {} + }; + + template + class pair_iterator_rev>, + std::void_t>> + : public iterator::iterator_storage_random_access_rev>, pair_iterator, pair_iterator_rev> + { + public: + explicit pair_iterator_rev(Iter1 begin1, Iter1 end1, Iter2 begin2, Iter2 end2): + iterator::iterator_storage_random_access_rev>, pair_iterator, pair_iterator_rev> + {std::reverse_iterator>{iterator::pair_wrapper{std::move(begin1), std::move(begin2)}}, + std::reverse_iterator>{iterator::pair_wrapper{std::move(end1), std::move(end2)}}} + {} + }; + + // CTAD for pair iterators + + template + pair_iterator(Iter1, Iter1, Iter2, Iter2) -> pair_iterator; + template static inline auto enumerate(const T(& container)[size]) { @@ -560,6 +688,36 @@ namespace blt { return enumerator{container.begin(), container.end(), container.size()}; } + + template + static inline auto in_pairs(const T& container1, const G& container2) + { + return pair_iterator{container1.begin(), container1.end(), container2.begin(), container2.end()}; + } + + template + static inline auto in_pairs(T& container1, G& container2) + { + return pair_iterator{container1.begin(), container1.end(), container2.begin(), container2.end()}; + } + + template + static inline auto in_pairs(const T(& container1)[size], const G(& container2)[size]) + { + return pair_iterator{&container1[0], &container1[size], &container2[0], &container2[size]}; + } + + template + static inline auto in_pairs(T(& container1)[size], G(& container2)[size]) + { + return pair_iterator{&container1[0], &container1[size], &container2[0], &container2[size]}; + } + + template + static inline auto in_pairs(T&& container1, G&& container2) + { + return pair_iterator{container1.begin(), container1.end(), container2.begin(), container2.end()}; + } } diff --git a/include/blt/std/ranges.h b/include/blt/std/ranges.h index f987b9e..1e8693b 100644 --- a/include/blt/std/ranges.h +++ b/include/blt/std/ranges.h @@ -134,35 +134,35 @@ namespace blt iterator end_; }; - template - static inline auto in_pairs(const T& container1, const G& container2) - { - return pair_enumerator{container1.begin(), container1.end(), container2.begin(), container2.end()}; - } - - template - static inline auto in_pairs(T& container1, G& container2) - { - return pair_enumerator{container1.begin(), container1.end(), container2.begin(), container2.end()}; - } - - template - static inline auto in_pairs(const T(& container1)[size], const G(& container2)[size]) - { - return pair_enumerator{&container1[0], &container1[size], &container2[0], &container2[size]}; - } - - template - static inline auto in_pairs(T(& container1)[size], G(& container2)[size]) - { - return pair_enumerator{&container1[0], &container1[size], &container2[0], &container2[size]}; - } - - template - static inline auto in_pairs(T&& container1, G&& container2) - { - return pair_enumerator{container1.begin(), container1.end(), container2.begin(), container2.end()}; - } +// template +// static inline auto in_pairs(const T& container1, const G& container2) +// { +// return pair_enumerator{container1.begin(), container1.end(), container2.begin(), container2.end()}; +// } +// +// template +// static inline auto in_pairs(T& container1, G& container2) +// { +// return pair_enumerator{container1.begin(), container1.end(), container2.begin(), container2.end()}; +// } +// +// template +// static inline auto in_pairs(const T(& container1)[size], const G(& container2)[size]) +// { +// return pair_enumerator{&container1[0], &container1[size], &container2[0], &container2[size]}; +// } +// +// template +// static inline auto in_pairs(T(& container1)[size], G(& container2)[size]) +// { +// return pair_enumerator{&container1[0], &container1[size], &container2[0], &container2[size]}; +// } +// +// template +// static inline auto in_pairs(T&& container1, G&& container2) +// { +// return pair_enumerator{container1.begin(), container1.end(), container2.begin(), container2.end()}; +// } template struct range