In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of advantages of using submodules:
- You can separate the code into different repositories.
| #include <cstdio> | |
| #include <cstdlib> | |
| #include <sys/epoll.h> | |
| #include <libudev.h> | |
| #include <string.h> | |
| enum class DeviceAction : std::size_t { | |
| Added = 0, | |
| Removed | |
| }; |
| /*! | |
| * Copyright (C) 2017-2018 Andreas Hollandt | |
| * | |
| * Distributed under the Boost Software License, Version 1.0. | |
| * See copy at http://boost.org/LICENSE_1_0.txt. | |
| */ | |
| #pragma once | |
| #include <exception> |
| // C++ includes used for precompiling -*- C++ -*- | |
| // Copyright (C) 2003-2013 Free Software Foundation, Inc. | |
| // | |
| // This file is part of the GNU ISO C++ Library. This library is free | |
| // software; you can redistribute it and/or modify it under the | |
| // terms of the GNU General Public License as published by the | |
| // Free Software Foundation; either version 3, or (at your option) | |
| // any later version. |
| #include <concepts> | |
| #include <vector> | |
| #include <cassert> | |
| #include <iostream> | |
| using namespace std; | |
| template <typename T> | |
| concept Comparable = requires (T a, T b) { | |
| {a < b} -> std::convertible_to<bool>; |
| package main | |
| import ( | |
| "cmp" | |
| "fmt" | |
| ) | |
| func compare[T cmp.Ordered](a T, b T) bool { | |
| return a > b | |
| } |
| from typing import TypeVar, Any, Protocol, Sequence, Generic | |
| class Comparable(Protocol): | |
| def __lt__(self, param: Any) -> bool: | |
| ... | |
| def __gt__(self, param: Any) -> bool: | |
| ... |
| #include <cstdint> | |
| #include <cassert> | |
| #include <vector> | |
| static constexpr int INF = 1'000'000'007; | |
| using i32 = std::int32_t; | |
| using namespace std; | |
| i32 LowerBound(const vector<i32>& nums, const i32 key) { |
| package main | |
| const INF = int(1e9 + 7) | |
| func LowerBound(nums []int, key int) int { | |
| lo := 0 | |
| hi := len(nums) - 1 | |
| ans := -1 | |
| for lo <= hi { | |
| mi := lo + (hi-lo)/2 |