Skip to content

Instantly share code, notes, and snippets.

View njlr's full-sized avatar
🌏
F# ing

njlr njlr

🌏
F# ing
View GitHub Profile

Buckaroo Contributor Agreement

The Buckaroo Contributor Agreement (this "Agreement") applies to any Contribution you make to any Work.

This is a binding legal agreement on you or you and the organization you represent. If you are signing this Agreement on behalf of your employer or other organization, you represent and warrant that you have the authority to agree to this Agreement on behalf of the organization.

Which party you are signing on behalf of is determined by the pull request to be merged. If the "base" branch of the pull request belongs to an individual, then the agreement is binding on that individual. If the "base" branch of the pull request belongs to an organization, then the agreement is binding on that organization.

1. Definitions

CXX Templates Templates with Forward Decls
clang 4.0 30s 12s compile + 16s link
g++ 6.2 48s 14s compile + 12s link
// ...
// Vector class above
// Forward declaration of common sizes
extern template class Vector<16>;
extern template class Vector<32>;
extern template class Vector<64>;
extern template class Vector<128>;
#include <vector.hpp>
// Instantiation of common sizes
template class Vector<16>;
template class Vector<32>;
template class Vector<64>;
template class Vector<128>;
// Vector<16> is in another binary
extern template class Vector<16>;
CXX Macros Preprocessed Macros Templates
clang 4.0 40s 37s 30s
g++ 6.2 61s 66s 48s
#define CREATE_VECTOR(D) \
struct Vector_##D {\
static constexpr int N = D;\
int data[N];\
\
Vector_##D (Vector_##D const& v) {\
for(int i=0; i<N ; ++i) {\
data[i] = v[i];\
}\
}\
template<int D>
struct Vector {
static constexpr unsigned N = D;
int data[N];
Vector(Vector<D> const& v) {
for (int i = 0; i < N; ++i) {
data[i] = v[i];
}
}
// Create a vector of 10 elements, all initialized to 0
auto v = Vector<10>(0);
// Set the 1st element to 7
v[0] = 7;
// Set the 9th element to 3
v[8] = 3;
// Print the sum of all elements
import com.google.common.base.Charsets;
import com.google.common.io.MoreFiles;
import com.google.common.io.ByteSink;
import java.nio.file.Path;
public final class GuavaFileUtils {
private GuavaFileUtils() {
}