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 <vector> | |
#include <algorithm> | |
#include <iostream> | |
constexpr struct { | |
// Ignore perfect forwarding. Assume basic types. | |
template< class X, class Y > | |
auto operator () ( X x, Y y ) | |
-> decltype(x*y) |
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
/* Last tested on: | |
* Ubuntu 12. | |
* | |
* clang version 3.2 | |
* (https://github.com/faisalv/clang-glambda.git ff891bdfef1794e0e7ad4343a3f696da4785462a) | |
* (llvm/trunk 167560) | |
*/ | |
#include <cstdio> | |
#include <vector> |
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
make[1]: Entering directory `/home/soc/src/gllvm/build/lib/Support' | |
make[1]: Nothing to be done for `all'. | |
make[1]: Leaving directory `/home/soc/src/gllvm/build/lib/Support' | |
make[1]: Entering directory `/home/soc/src/gllvm/build/lib/TableGen' | |
make[1]: Nothing to be done for `all'. | |
make[1]: Leaving directory `/home/soc/src/gllvm/build/lib/TableGen' | |
make[1]: Entering directory `/home/soc/src/gllvm/build/utils' | |
make[2]: Entering directory `/home/soc/src/gllvm/build/utils/FileCheck' | |
make[2]: Nothing to be done for `all'. | |
make[2]: Leaving directory `/home/soc/src/gllvm/build/utils/FileCheck' |
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
#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 <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 <tuple> | |
template< class X > struct Hold { | |
X x; | |
constexpr Hold( X x ) : x(std::move(x)) { } | |
}; | |
constexpr auto a = Hold<int>( 1 ); | |
constexpr auto b = Hold<std::tuple<int>>( std::tuple<int>(1) ); |
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 <iostream> | |
#include <vector> | |
#include <algorithm> | |
using namespace std; | |
void print_vec( const char* const name, const vector<int>& v ) { | |
cout << name << " = "; |
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> | |
/* MakeT T : X -> T X */ | |
template< template<class...> class T > struct MakeT { |
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
examples.cpp: In function 'int main()': | |
examples.cpp:234:10: warning: variable 'o' set but not used [-Wunused-but-set-variable] | |
In file included from /usr/include/c++/4.7/bits/stl_algo.h:68:0, | |
from /usr/include/c++/4.7/algorithm:63, | |
from Pure.h:4, | |
from examples.cpp:2: | |
/usr/include/c++/4.7/functional: In instantiation of 'static _Res std::_Function_handler<_Res(_ArgTypes ...), _Functor>::_M_invoke(const std::_Any_data&, _ArgTypes ...) [with _Res = std::unique_ptr<std::pair<int, int> >; _Functor = pure::arrow::KleisliF<std::unique_ptr, int, std::pair<int, int>, pure::Composition<pure::arrow::KleisliF<std::unique_ptr, std::pair<int, int>, std::pair<int, int>, pure::BComposition<pure::Part<pure::monad::LiftM, pure::MakeT<std::pair> >, std::function<std::unique_ptr<int>(int)>, std::function<std::unique_ptr<int>(int)> > >, pure::arrow::Duplicate> >; _ArgTypes = {int}]': | |
/usr/include/c++/4.7/functional:2298:6: required from 'std::function<_Res(_ArgTypes ...)>::fun |