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
/** | |
* \file boostache_adapted_fusion_example.cpp | |
* | |
* Copyright 2016 Jens Weller : meetingcpp.com | |
* | |
* Distributed under the Boost Software License, Version 1.0. | |
*/ | |
#include <iostream> | |
#include <boost/spirit/include/support_extended_variant.hpp> |
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
template<class Import, class StringType = boost::string_ref> | |
struct JsonVisitor | |
{ | |
JsonVisitor(Import& import,const boost::dynamic_bitset& filterresult):import(import),key(key),filterresult(filterresult){} | |
template<class Value> | |
bool operator()(const Value& v)const | |
{ | |
import.processKeyValue(current_key,v); | |
return true; | |
} |
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
cmake_minimum_required(VERSION 2.8.11) | |
project(cmakeqttest) | |
# Find includes in corresponding build directories | |
set(CMAKE_INCLUDE_CURRENT_DIR ON) | |
# Instruct CMake to run moc automatically when needed. | |
set(CMAKE_AUTOMOC ON) | |
set(CMAKE_AUTOUIC ON) | |
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") |
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 <type_traits> | |
#include <boost/tti/has_member_function.hpp> | |
#include <boost/function_types/result_type.hpp> | |
struct Interface | |
{ | |
std::string interface()const | |
{ |
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 <boost/mp11.hpp> | |
#include <boost/mp11/mpl.hpp> | |
#include <boost/fusion/sequence/intrinsic/at_c.hpp> | |
#include <boost/fusion/include/at.hpp> | |
#include <boost/fusion/tuple/tuple.hpp> | |
#include <boost/fusion/adapted/struct/adapt_struct.hpp> | |
#include <boost/fusion/support/deduce_sequence.hpp> | |
//#include <boost/fusion/adapted.hpp> |
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
template<class Seq> | |
constexpr std::array<const char*,boost::fusion::result_of::size<Seq>::value> get_member_names() | |
{ | |
std::array<const char*,boost::fusion::result_of::size<Seq>::value> members{}; | |
boost::mp11::mp_for_each< boost::mp11::mp_iota_c<boost::fusion::result_of::size<Seq>::value>>( | |
[&]( auto I ){ | |
members[I]=boost::fusion::extension::struct_member_name<Seq,I>::call(); | |
} ); | |
return members; | |
} |
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
namespace detail{ | |
template <size_t I> | |
struct fusion_visit_impl | |
{ | |
template <typename Seq, typename F> | |
static void visit(Seq& s, size_t idx, F&& fun) | |
{ | |
static_assert(boost::fusion::result_of::size<Seq>::value >= I,"fusion index out of bounds"); | |
if (idx == I - 1) fun(boost::fusion::get<I - 1>(s)); | |
else fusion_visit_impl<I - 1>::visit(s, idx, std::forward<F>(fun)); |