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 <tuple> | |
#include <iostream> | |
template< size_t ...i > struct IndexList {}; | |
template< size_t ... > struct EnumBuilder; | |
// Increment cur until cur == end. | |
template< size_t end, size_t cur, size_t ...i > |
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 <memory> | |
#include <iostream> | |
#include <sstream> | |
#include <utility> | |
#include <algorithm> | |
#include <iterator> | |
struct sequence_tag {}; | |
struct pointer_tag {}; |
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 <memory> | |
#include <utility> | |
#include <iostream> | |
#include <algorithm> | |
#include <iterator> | |
struct sequence_tag {}; | |
struct pointer_tag {}; | |
template< class X > |
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
using System.IO; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using UnityEditor; | |
// Full disclosure: This is based on another gist, but I neglected to write down the link to it. | |
[CreateAssetMenu] | |
public class IconPacker : ScriptableObject { | |
public Texture2D[] textures; |
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
// compile with g++ ecs.cpp -std=c++2a -o run && ./run | |
// Taken from my project, https://github.com/splinterofchaos/py-srpg | |
#include <vector> | |
#include <tuple> | |
#include <iostream> | |
template<typename F, typename...T> | |
constexpr auto tuple_map(F&& f, const std::tuple<T...>& t) { | |
return std::tuple(f(std::get<T>(t))...); |
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 <memory> | |
#include <iostream> | |
#include <sstream> | |
#include <utility> | |
#include <algorithm> | |
#include <iterator> | |
struct sequence_tag {}; | |
struct pointer_tag {}; |
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
struct Seq { | |
size_t start, size; | |
}; | |
ostream& operator<<(ostream& os, const Seq& s) { | |
return os << "[" << s.start << ", " << s.size << ")"; | |
} | |
// Returns the number of replacements or additions required to break sequences to have no triplets. |
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> | |
template< class F, class X, class S > | |
constexpr X foldl( F&& f, X x, const S& s ) { | |
return std::accumulate ( | |
std::begin(s), std::end(s), |
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
diff --git a/include/ftl/function.h b/include/ftl/function.h | |
index 1911efa..c9ccc54 100644 | |
--- a/include/ftl/function.h | |
+++ b/include/ftl/function.h | |
@@ -350,13 +350,30 @@ namespace ftl { | |
template<typename R, typename P1, typename P2, typename...Ps> | |
struct curried<R,P1,P2,Ps...> { | |
- | |
- function<R(P2,Ps...)> operator() (P1 p1) const { |
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
diff --git a/include/ftl/function.h b/include/ftl/function.h | |
index 1911efa..605db4f 100644 | |
--- a/include/ftl/function.h | |
+++ b/include/ftl/function.h | |
@@ -331,6 +331,7 @@ namespace ftl { | |
/* TODO: Make currying work even when we give N > 1, N < Nparams | |
* arguments to a function of Nparams parameters. | |
*/ | |
+ | |
template<typename...> |
NewerOlder