Skip to content

Instantly share code, notes, and snippets.

#ifndef TRIBOOL_HPP
#define TRIBOOL_HPP
#include <boost/config.hpp>
namespace logic {
struct indeterminate_t;
struct tribool {
enum tribool_value_t {
false_value = false,
@kikairoya
kikairoya / gdb72.patch
Created December 18, 2010 11:42
diff for gdb-7.2 --build=x86_64-*-linux-gnu --host=x86_64-w64-mingw32 --target=h8300-elf/m32c-elf
diff --git a/sim/h8300/compile.c b/sim/h8300/compile.c
index 44d60f6..56ecf3b 100644
--- a/sim/h8300/compile.c
+++ b/sim/h8300/compile.c
@@ -37,6 +37,9 @@
#ifndef SIGTRAP
# define SIGTRAP 5
#endif
+#ifndef SIGBUS
+# define SIGBUS 14
#include <array>
#include <type_traits>
template <typename U, typename ...Args>
struct make_array_impl_ {
template <typename T, typename Void, typename NonVoid>
struct if_void_else { typedef NonVoid type; };
template <typename Void, typename NonVoid>
struct if_void_else<void, Void, NonVoid> { typedef Void type; };
template <typename T = void, typename ElemT = typename if_void_else<T, U, T>::type >
#include <tuple>
#include <type_traits>
using std::tuple;
template <int n>
struct int_: std::integral_constant<int, n> { };
typedef int_<0> zero_;
template <typename l>
struct decrement: int_<l::value-1> {
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 / stdin_stream.hpp
Created April 9, 2011 03:47
boost::asio AsyncReadStream for console input
class stdin_stream: boost::noncopyable {
typedef boost::function<void (const boost::system::error_code &, size_t bytes_transferred)> read_handler_type;
public:
stdin_stream(boost::asio::io_service &io, HANDLE hin): io(io), hin(hin), hev(CreateEvent(0, 0, 0, 0)), handler(), buffer(0), size(0) {
_beginthread(&stdin_stream::thread_handler_gateway, 0, this);
}
~stdin_stream() {
buffer = 0;
CloseHandle(hev);
}
@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;