Skip to content

Instantly share code, notes, and snippets.

View eiennohito's full-sized avatar

Arseny Tolmachev eiennohito

  • Hakuhodo Technologies
  • Osaka, Japan
View GitHub Profile
package code.comet
import net.liftweb._
import http._
import util._
/**
* The screen real estate on the browser will be represented
* by this component. When the component changes on the server
* the changes are automatically reflected in the browser.
Index: boost/range/join.hpp
===================================================================
--- boost/range/join.hpp (revision 75422)
+++ boost/range/join.hpp (working copy)
@@ -26,7 +26,7 @@
{
public:
typedef iterator_range<
- range_detail::join_iterator<
+ ::boost::range_detail::join_iterator<
package org.eiennohito.scot.db
import net.liftweb.util.Props
import net.liftweb.mongodb.{MongoMeta, MongoIdentifier}
/**
* @author eiennohito
* @since 17.11.11
*/
package org.eiennohito.scot.epwing.simple.gaiji
import util.parsing.combinator.RegexParsers
/**
* @author eiennohito
* @since 09.12.11
*/
abstract class Literal {
@eiennohito
eiennohito / nullptr_constexpr.cpp
Created February 7, 2012 13:37
C++11 nullptr constexpr problem (Example from Chandler Carruth's speech on GoingNative 2012)
#include <iostream>
struct S { int n; };
struct X { X(int) {} };
void f(void*) {
std::cerr << "Pointer!\n";
}
void f(X) {
std::cerr << "X!\n";
}
int main() {
{
"cards":[{
"createdOn":"20090409T135047.000Z",
"cardMode":1,
"_id":1688,
"word":1507329
},{
"createdOn":"20090409T135024.000Z",
"cardMode":2,
"_id":1687,
@eiennohito
eiennohito / test.cpp
Created March 1, 2012 05:43
VC++11 compiler error when using boost::range::adaptors
// TestApp.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <conio.h>
#include <functional>
#include <boost/range/algorithm/copy.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/transformed.hpp>
#include <cmath>
#include <iostream>
int main(int argc, char** argv) {
std::cout << "Hello, " << std::fpclassify(1.3) << "\n";
}
#include "stdafx.h"
#include <iostream>
#include <vector>
struct Person {
private:
int age;
public:
int getAge() const { return age; }
Person() { age = rand() % 100 + 1; }
struct IteratorIterator {
template<class T, typename Func>
auto average(Func foo, T collection) -> decltype(foo(*collection.begin())) {
decltype(foo(*collection.begin())) accum = 0;
int size = 0;
for (typename T::const_iterator i = collection.begin(); i != collection.end(); ++i, size++) {
typename T::const_reference ref = *i;
accum += foo(ref);
}