This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <limits> | |
#include <ostream> | |
#include <stdexcept> | |
#include <system_error> | |
#include <type_traits> | |
#include <assert.h> | |
#include <stdint.h> | |
#include <stdio.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <algorithm> | |
#include <assert.h> | |
#include <cmath> | |
#include <errno.h> | |
#include <iterator> | |
#include <stdlib.h> | |
namespace csv | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
st = status | |
fix = commit --amend -C HEAD | |
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative | |
discard = reset HEAD -- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Calculate the current package version number based on git tags. | |
If possible, use the output of `git describe` modified to conform to the | |
versioning scheme that setuptools uses (see PEP 386). Releases must be | |
labelled with annotated tags (signed tags are annotated) of the following | |
format: | |
v<num>(.<num>)+ [ {a|b|c|rc} <num> (.<num>)* ] | |
If `git describe` returns an error (likely because we're in an unpacked copy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <functional> | |
class Solution { | |
public: | |
ListNode* removeElements(ListNode* head, int val) { | |
auto ls = std::ref(head); | |
while (ls != nullptr) { | |
if (ls.get()->val == val) { | |
auto p = ls.get(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <type_traits> | |
#include <utility> | |
namespace etude { | |
template<class... Fs> | |
struct overloaded_function_impl_; | |
template<> | |
struct overloaded_function_impl_<> { | |
template<class... Args, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <functional> | |
#include <stdexcept> | |
#include <tuple> | |
#include <type_traits> | |
template <int Low, int High, int Mid = (Low + High) / 2> | |
inline constexpr auto _visit_at = nullptr; | |
template <int Low, int High, int Mid> | |
requires(Low > High) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright 2015 Rackspace, Inc. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <type_traits> | |
#include <tuple> | |
#include <iostream> | |
// Link: https://github.com/aeyakovenko/notes | |
//count arguments | |
//COUNT_ARGS :: ... -> Int | |
#define COUNT_ARGS(...) COUNT_ARGS_(,##__VA_ARGS__,6,5,4,3,2,1,0) | |
#define COUNT_ARGS_(z,a,b,c,d,e,f,cnt,...) cnt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <algorithm> | |
#include <vector> | |
#include <iterator> | |
#include <iostream> | |
int main() | |
{ | |
std::vector<int> v; | |
// instead of asking for iota_n(std::back_inserter(v), 10, 1); | |
std::generate_n(back_inserter(v), 10, [n = 0]() mutable { return ++n; }); |
NewerOlder