Skip to content

Instantly share code, notes, and snippets.

View ahcox's full-sized avatar

Andrew H. Cox ahcox

View GitHub Profile
@ahcox
ahcox / error_log.cpp
Last active August 18, 2017 00:21
Error log using stlab develop branch at commit 255379c430c002d75efe1e3218ea4fc92255421a Author: Sean Parent Date: Tue Jul 25 23:25:59 2017 -0700 Backing out an unintentional change.
/Applications/CLion.app/Contents/bin/cmake/bin/cmake --build /Users/ahcox/Library/Caches/CLion2016.2/cmake/generated/stlab_experiments-e68879c1/e68879c1/Debug --target async_error_repro2 -- -j 8
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/ahcox/Library/Caches/CLion2016.2/cmake/generated/stlab_experiments-e68879c1/e68879c1/Debug
[ 50%] Building CXX object CMakeFiles/async_error_repro2.dir/async_error_repro2.cpp.o
In file included from /Users/ahcox/checkouts/stlab_experiments/async_error_repro2.cpp:9:
In file included from /Users/ahcox/checkouts/stlab/stlab/concurrency/future.hpp:22:
In file included from /Users/ahcox/checkouts/stlab/stlab/concurrency/executor_base.hpp:16:
/Users/ahcox/checkouts/stlab/stlab/concurrency/task.hpp:78:52: error: no matching function for call to object of type 'std::__1::__bind<(lambda at /Users/ahcox/checkouts/stlab/stlab/concurrency/future.hpp:1278:19), const int &, const long double &, std::__1::reference_wrapper<SharedState> >'
R in
@ahcox
ahcox / async_error_repro2.cpp
Last active August 18, 2017 10:36
Repro for async not accepting reference parameters wrapped in std::ref and std::cref
//
// Created by Andrew Cox 2017.
//
#include <iostream>
#include <future>
#include <stlab/concurrency/default_executor.hpp>
#include <stlab/concurrency/future.hpp>
@ahcox
ahcox / async_error_repro1.cpp
Created August 17, 2017 17:06
Repro for stlab::async() not accepting non-const reference parameters
//
// Created by Andrew Cox 2017.
//
#include <iostream>
#include <future>
#include <stlab/concurrency/default_executor.hpp>
#include <stlab/concurrency/future.hpp>
@ahcox
ahcox / dump_touch.cpp
Last active August 7, 2017 15:21
Dump a Cocos2D-x Touch to an ostream like std::cerr
void dumpTouch(std::ostream& out, const cocos2d::Touch* touch)
{
if(touch){
const auto loc = touch->getLocation();
const auto prev = touch->getPreviousLocation();
const auto start = touch->getStartLocation();
const auto delta = touch->getDelta();
const auto id = touch->getID();
const auto viewLoc = touch->getLocationInView();
const auto viewPrev = touch->getPreviousLocationInView();