Skip to content

Instantly share code, notes, and snippets.

Program received signal SIGSEGV, Segmentation fault.
0x00000000004318de in operator() (function_obj_ptr=..., a0=@0x7fffffff9d70, a1=@0x7fffffffdfd0, a2=..., a3=<value optimized out>) at /usr/local/gcc-self/include/boost/function/function_template.hpp:1013
1013 (this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS);
(gdb) bt
#0 0x00000000004318de in operator() (function_obj_ptr=..., a0=@0x7fffffff9d70, a1=@0x7fffffffdfd0, a2=..., a3=<value optimized out>) at /usr/local/gcc-self/include/boost/function/function_template.hpp:1013
#1 parse<boost::fusion::unused_type const, boost::fusion::unused_type, boost::fusion::unused_type const> (function_obj_ptr=..., a0=@0x7fffffff9d70, a1=@0x7fffffffdfd0, a2=..., a3=<value optimized out>) at /usr/local/gcc-self/include/boost/spirit/home/qi/nonterminal/rule.hpp:280
#2 parse<char const*, boost::fusion::unused_type const, boost::fusion::unused_type, boost::fusion::unused_type const> (function_obj_ptr=..., a0=@0x7fffffff9d70, a1=@0x7fffffffdfd0, a2=..., a3=
diff --git a/boost/range/detail/indirect_functor_invoke_pp.hpp b/boost/range/detail/indirect_functor_invoke_pp.hpp
index 4680e0c..efd5132 100644
--- a/boost/range/detail/indirect_functor_invoke_pp.hpp
+++ b/boost/range/detail/indirect_functor_invoke_pp.hpp
@@ -15,14 +15,14 @@
#define BOOST_RANGE_DETAIL_INDIRECT_FUNCTOR_INVOKE_HELPER(n,arg_seq) \
template <BOOST_PP_ENUM_PARAMS(BOOST_PP_EXPAND(BOOST_PP_SEQ_SIZE(arg_seq)), class A)> \
- typename boost::result_of<indirected_functor_type(BOOST_PP_ENUM_PARAMS(BOOST_PP_EXPAND(BOOST_PP_SEQ_SIZE(arg_seq)), A))>::type \
+ typename boost::result_of<indirected_functor_type(BOOST_PP_SEQ_FOR_EACH_I(BOOST_RANGE_DETAIL_INDIRECT_FUNCTOR_ARG, 0, arg_seq))>::type \
**** g++-4.5 ****
regular_example.cpp:41:85: error: no match for 'operator|' in 'boost::range::iteration(const Init&, Next) [with Init = int, Next = boost::range::detail::indirect_functor<boost::shared_ptr<boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::arithmetic_action<boost::lambda::multiply_action>, boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, const int, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type> > > > >](boost::range::regular(F) [with F = boost::lambda::lambda_functor<boost::lambda::lambda_functor_base<boost::lambda::arithmetic_action<boost::lambda::m
ultiply_action>, boost::tuples::tuple<boost::lambda::lambda_functor<boost::lambda::placeholder<1> >, const int, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tuples::null_type, boost::tu
@kikairoya
kikairoya / asio_range_util.hpp
Created April 7, 2011 05:11
asio http client without istream
#ifndef ASIO_RANGE_UTIL_HPP_
#define ASIO_RANGE_UTIL_HPP_
#include <boost/range/iterator_range.hpp>
#include <boost/range/algorithm/search.hpp>
#include <boost/asio/buffer.hpp>
namespace httpc {
template <typename T>
inline boost::iterator_range<T *> make_iterator_range_from_memory(T *head, size_t size) {
@kikairoya
kikairoya / string_piece.hpp
Created October 14, 2011 06:32
string_piece
#include <string>
#include <iterator>
template <typename charT>
class basic_string_piece {
public:
typedef std::char_traits<charT> trait_type;
typedef typename trait_type::char_type char_type;
typedef const char_type *const_pointer;
typedef const char_type &const_reference;
#include <vector>
class myclass{
public:
myclass(const std::vector<int>&){
throw std::exception();
}
private:
myclass() = delete;
};
#include <array>
#include <type_traits>
template <typename T, std::size_t N>
constexpr std::size_t size(const std::array<T, N> &a) { return a.size(); }
template <typename A> // テンプレートでなくても同じ
void f(const A &a) {
char x[a.size()]; // VLA扱いされる。std::array::size()はconstexprになっている
char y[size(a)]; // 一段噛ませると通る
#ifdef __GNUG__
#include <cxxabi.h>
std::string demangle(const std::string &s) {
int r;
char *const p = abi::__cxa_demangle(s.c_str(), 0, 0, &r);
if (r) return s;
try {
const std::string x(p);
free(p);
p = 0;
#include <iostream>
#include <thread>
#include <future>
#include <chrono>
#include <functional>
#include <deque>
struct task_queue {
task_queue() = default;
task_queue(const task_queue &) = delete;
@kikairoya
kikairoya / gthr-win32-gcc471.patch
Created January 22, 2012 10:10
implement condition-variable to gthr-win32 needed for std::thread family. modify from gcc-4.7.0.
diff --git a/libgcc/config/i386/gthr-win32.c b/libgcc/config/i386/gthr-win32.c
index ab1b69f..4b35582 100644
--- a/libgcc/config/i386/gthr-win32.c
+++ b/libgcc/config/i386/gthr-win32.c
@@ -1,11 +1,13 @@
/* Implementation of W32-specific threads compatibility routines for
libgcc2. */
-/* Copyright (C) 1999, 2000, 2002, 2004, 2008, 2009, 2011
+/* Copyright (C) 1999, 2000, 2002, 2004, 2008, 2009, 2011, 2012