Seqan mini-bowtie example not compiling - c++

I try to copy the example of mini-bowtie from the Seqan Web site.
Note that the example comes from version 1.4.2, not the current one.
When I compile, I have an error.
The minimal reproducible example is:
#include <seqan/index.h>
#include <seqan/store.h>
using namespace seqan;
int main()
{
typedef Index<StringSet<Dna5String>, FMIndex<> > TIndex;
typedef Iterator<TIndex, TopDown<ParentLinks<> > >::Type TIter;
FragmentStore<> fragStore;
StringSet<Dna5String> text;
TIndex fmIndex(text);
TIter it(fmIndex);
it = TIter(fmIndex); // This does not work
return 0;
}
The compiling error is quite long.
It starts with:
In file included from test.cpp:1:
In file included from /usr/include/seqan/index.h:172:
/usr/include/seqan/index/index_fm_stree.h:469:16: error: no matching constructor for initialization of 'TVertexDescriptor' (aka 'VertexFM<unsigned long, seqan::SimpleType<unsigned char, seqan::Dna5_> >')
return TVertexDescriptor(back(it.history).range, back(it.history).repLen, back(it.history).lastChar);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/seqan/index/index_esa_stree.h:245:27: note: in instantiation of function template specialization 'seqan::nodeUp<seqan::StringSet<seqan::String<seqan::SimpleType<unsigned char, seqan::Dna5_>,
seqan::Alloc<void> >, seqan::Owner<seqan::Tag<seqan::Default_> > >, void, seqan::FMIndexConfig<void, unsigned long, 1, 1>, seqan::Preorder>' requested here
_parentDesc = nodeUp(_origin);
^
/usr/include/seqan/index/index_esa_stree.h:366:29: note: in instantiation of function template specialization 'seqan::Iter<seqan::Index<seqan::StringSet<seqan::String<seqan::SimpleType<unsigned char,
seqan::Dna5_>, seqan::Alloc<void> >, seqan::Owner<seqan::Tag<seqan::Default_> > >, seqan::FMIndex<void, seqan::FMIndexConfig<void, unsigned long, 1, 1> > >, seqan::VSTree<seqan::TopDown<seqan::Preorder> >
>::operator=<seqan::ParentLinks<seqan::Preorder> >' requested here
*(TBase*)(this) = _origin;
^
test.cpp:17:8: note: in instantiation of member function 'seqan::Iter<seqan::Index<seqan::StringSet<seqan::String<seqan::SimpleType<unsigned char, seqan::Dna5_>, seqan::Alloc<void> >,
seqan::Owner<seqan::Tag<seqan::Default_> > >, seqan::FMIndex<void, seqan::FMIndexConfig<void, unsigned long, 1, 1> > >, seqan::VSTree<seqan::TopDown<seqan::ParentLinks<seqan::Preorder> > > >::operator='
requested here
it = TIter(fmIndex);
^
It seems that the API has slightly changed, but I cannot exactly put the finger on it.
I compile with:
clang++ -Wall -Wextra -Weffc++ -O2 -o testSeqan test.cpp -lrt
with clang++ 6.0.0-1ubuntu2 x86_64-pc-linux-gnu, but g++ Ubuntu 7.3.0-16ubuntu3 gives similar (albeit less readable) results, and Seqan version 2.3.2.
What should I change?

Related

What is behaviour of cpp sort function, by using default overloaded greater function for vector<vector<int>>

Difference between sort(begin(ans), end(ans)) vs sort(begin(ans), end(ans), std::greater<std::vector<std::vector<int> > >())
as sort(begin(ans), end(ans)) works perfectly as expected where as specifing the greater doesn't works.
vector<int> S = {12,13, 34, 9,10};
vector<vector<int> >ans;
vector<int> currSet;
subset(0, S, currSet, ans);
sort(begin(ans), end(ans), std::greater<std::vector<std::vector<int> > >());
cout << ans.size();
}
give error
In file included from subset.cpp:1:
In file included from /usr/local/include/bits/stdc++.h:52:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/ccomplex:21:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/complex:247:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/sstream:174:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/ostream:138:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/ios:216:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__locale:15:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/string:505:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/string_view:176:
In file included from /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/__string:57:
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/algorithm:3832:17: error: no
matching function for call to object of type
'std::__1::greater<std::__1::vector<std::__1::vector<int, std::__1::allocator<int> >,
std::__1::allocator<std::__1::vector<int, std::__1::allocator<int> > > > >'
if (__comp(*--__last, *__first))
^~~~~~
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/algorithm:4018:5: note: in
instantiation of function template specialization
'std::__1::__sort<std::__1::greater<std::__1::vector<std::__1::vector<int,
std::__1::allocator<int> >, std::__1::allocator<std::__1::vector<int,
std::__1::allocator<int> > > > > &, std::__1::vector<int, std::__1::allocator<int> >
*>' requested here
__sort<_Comp_ref>(__first, __last, __comp);
^
/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/algorithm:4052:12: note: in
instantiation of function template specialization
'std::__1::sort<std::__1::vector<int, std::__1::allocator<int> > *,
std::__1::greater<std::__1::vector<std::__1::vector<int, std::__1::allocator<int> >,
std::__1::allocator<std::__1::vector<int, std::__1::allocator<int> > > > > &>'
requested here
_VSTD::sort<_Tp*, _Comp_ref>(__first.base(), __last.base(), __comp);
^
subset.cpp:33:3: note: in instantiation of function template specialization
'std::__1::sort<std::__1::vector<int, std::__1::allocator<int> >,
std::__1::greater<std::__1::vector<std::__1::vector<int, std::__1::allocator<int> >,
std::__1::allocator<std::__1::vector<int, std::__1::allocator<int> > > > > >'
requested here
sort(all(ans), greater<vector<vector<int> > >());
^
std::greater<std::vector<std::vector<int> > > is for comparing objects of type std::vector<std::vector<int> >. But the vector ans does not contain objects of that type. It contains objects of type std::vector<int>. Thus, the comparator that you need is std::greater<std::vector<int>>. Or, you could simply use std::greater<> which is simpler to read, write and less likely to result in a bug.
The template prameter for std::greater needs to be the element type that the iterators point to. Since the iterator for of std::vector<std::vector<int>> has a value_type of std::vector<int> (that's the type of the of the elements in ans) that is what you need. That gives you
sort(begin(ans), end(ans), std::greater<std::vector<int> >());
as what you need.
Also note that a space is no longer required for the closing > in a template parameter list. You can use
sort(begin(ans), end(ans), std::greater<std::vector<int>>());
and that will compile in a C++11+ compliant compiler.

Boost Geometry: assertion_failed error C++

I have the following header file in order to use boost geometry types:
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/multi/geometries/multi_polygon.hpp>
#include <boost/geometry/geometries/register/point.hpp>
using namespace boost::geometry;
using namespace detail::assign;
typedef model::d2::point_xy<double> point_xy;
typedef model::polygon<point_xy> polygon;
typedef model::multi_polygon<polygon> multi_polygon;
typedef model::box<point_xy> box;
When compiling a file that attempts to use these types, I get a massive compiler error:
In file included from src/geometry.cpp:11:
In file included from src/../include/geometry.hpp:9:
In file included from /usr/local/include/boost/geometry.hpp:17:
In file included from /usr/local/include/boost/geometry/geometry.hpp:26:
In file included from /usr/local/include/boost/geometry/core/coordinate_dimension.hpp:23:
/usr/local/include/boost/geometry/core/point_type.hpp:45:5: error: no matching function for call to 'assertion_failed'
BOOST_MPL_ASSERT_MSG
^~~~~~~~~~~~~~~~~~~~
/usr/local/include/boost/mpl/assert.hpp:454:51: note: expanded from macro 'BOOST_MPL_ASSERT_MSG'
# define BOOST_MPL_ASSERT_MSG( c, msg, types_ ) \
^
/usr/local/include/boost/mpl/assert.hpp:440:9: note: expanded from macro '\
BOOST_MPL_ASSERT_MSG_IMPL'
boost::mpl::assertion_failed<(c)>( BOOST_PP_CAT(mpl_assert_arg,counter)::assert_arg() ) \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/boost/mpl/assert.hpp:60:58: note: expanded from macro '\
BOOST_MPL_AUX_ASSERT_CONSTANT'
# define BOOST_MPL_AUX_ASSERT_CONSTANT(T, expr) enum { expr }
^~~~
/usr/local/include/boost/geometry/core/point_type.hpp:65:30: note: in instantiation of template class
'boost::geometry::traits::point_type<std::__1::vector<float, std::__1::allocator<float> > >' requested here
typename traits::point_type<Geometry>::type
^
/usr/local/include/boost/geometry/core/coordinate_type.hpp:58:22: note: in instantiation of template class 'boost::geometry::core_dispatch::point_type<void,
std::__1::vector<float, std::__1::allocator<float> > >' requested here
typedef typename point_type<GeometryTag, Geometry>::type point_type;
^
/usr/local/include/boost/geometry/core/coordinate_type.hpp:88:37: note: in instantiation of template class 'boost::geometry::core_dispatch::coordinate_type<void,
std::__1::vector<float, std::__1::allocator<float> > >' requested here
typedef typename core_dispatch::coordinate_type
^
/usr/local/include/boost/geometry/core/access.hpp:269:17: note: in instantiation of template class 'boost::geometry::coordinate_type<std::__1::vector<float,
std::__1::allocator<float> > >' requested here
inline typename coordinate_type<Geometry>::type get(Geometry const& geometry
^
/usr/local/include/boost/geometry/algorithms/detail/convert_point_to_point.hpp:42:74: note: while substituting deduced template arguments into function template
'get' [with Dimension = 0, Geometry = std::__1::vector<float, std::__1::allocator<float> >]
set<Dimension>(destination, boost::numeric_cast<coordinate_type>(get<Dimension>(source)));
^
/usr/local/include/boost/geometry/algorithms/detail/convert_point_to_point.hpp:58:76: note: (skipping 3 contexts in backtrace; use -ftemplate-backtrace-limit=0
to see all)
point_to_point<Source, Destination, 0, dimension<Destination>::value>::apply(source, destination);
^
/usr/local/include/boost/geometry/algorithms/append.hpp:129:45: note: in instantiation of member function
'boost::geometry::detail::append::append_range<boost::geometry::model::ring<boost::geometry::model::d2::point_xy<double, boost::geometry::cs::cartesian>,
true, true, vector, allocator>, std::__1::vector<std::__1::vector<float, std::__1::allocator<float> >, std::__1::allocator<std::__1::vector<float,
std::__1::allocator<float> > > > >::apply' requested here
append_range<ring_type, Range>::apply(
^
/usr/local/include/boost/geometry/algorithms/append.hpp:296:51: note: in instantiation of member function
'boost::geometry::detail::append::range_to_polygon<boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double,
boost::geometry::cs::cartesian>, true, true, std::vector, std::vector, std::allocator, std::allocator>, std::__1::vector<std::__1::vector<float,
std::__1::allocator<float> >, std::__1::allocator<std::__1::vector<float, std::__1::allocator<float> > > > >::apply' requested here
dispatch::append<Geometry, RangeOrPoint>::apply(geometry,
^
/usr/local/include/boost/geometry/algorithms/append.hpp:371:22: note: in instantiation of function template specialization
'boost::geometry::resolve_variant::append<boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double, boost::geometry::cs::cartesian>,
true, true, std::vector, std::vector, std::allocator, std::allocator> >::apply<std::__1::vector<std::__1::vector<float, std::__1::allocator<float> >,
std::__1::allocator<std::__1::vector<float, std::__1::allocator<float> > > > >' requested here
::apply(geometry, range_or_point, ring_index, multi_index);
^
/usr/local/include/boost/geometry/algorithms/assign.hpp:75:15: note: in instantiation of function template specialization
'boost::geometry::append<boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double, boost::geometry::cs::cartesian>, true, true,
std::vector, std::vector, std::allocator, std::allocator>, std::__1::vector<std::__1::vector<float, std::__1::allocator<float> >,
std::__1::allocator<std::__1::vector<float, std::__1::allocator<float> > > > >' requested here
geometry::append(geometry, range, -1, 0);
^
src/geometry.cpp:213:5: note: in instantiation of function template specialization
'boost::geometry::assign_points<boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double, boost::geometry::cs::cartesian>, true, true,
std::vector, std::vector, std::allocator, std::allocator>, std::__1::vector<std::__1::vector<float, std::__1::allocator<float> >,
std::__1::allocator<std::__1::vector<float, std::__1::allocator<float> > > > >' requested here
assign_points(poly, shape.border);
^
/usr/local/include/boost/mpl/assert.hpp:83:5: note: candidate function not viable: no known conversion from 'boost::mpl::failed
************(boost::geometry::traits::point_type<std::__1::vector<float, std::__1::allocator<float> >
>::NOT_IMPLEMENTED_FOR_THIS_POINT_TYPE::************)(types<std::__1::vector<float, std::__1::allocator<float> > >)' to 'typename assert<false>::type'
(aka 'mpl_::assert<false>') for 1st argument
int assertion_failed( typename assert<C>::type );
^
In file included from src/geometry.cpp:11:
In file included from src/../include/geometry.hpp:9:
In file included from /usr/local/include/boost/geometry.hpp:17:
In file included from /usr/local/include/boost/geometry/geometry.hpp:28:
/usr/local/include/boost/geometry/core/coordinate_type.hpp:43:5: error: no matching function for call to 'assertion_failed'
BOOST_MPL_ASSERT_MSG
^~~~~~~~~~~~~~~~~~~~
/usr/local/include/boost/mpl/assert.hpp:454:51: note: expanded from macro 'BOOST_MPL_ASSERT_MSG'
# define BOOST_MPL_ASSERT_MSG( c, msg, types_ ) \
I have seen this post in which they did not register tuples - however, I am not using tuples or any special kind of point - I am just attempting to use the built in geometry types. Why is this error still occurring?
As you can see, the code posted is not a problem per se: Live On Coliru.
So,there must be something else interfering. I have three hunches:
It's somewhere else in your code that you didn't post. The cause of the error is in ../src/geometry.cpp (not Boost library):
assign_points(poly, shape.border);
That gives you good ideas on how to reduce to a MCVE.
You have preprocessor issues. Try pre-processing your sources and see whether any of the code appearing in the error messages looks suspect.
A classical example of this would be if some other included header defines tokens like #define min(a,b) ... or other commonly used words.
Side note: this is about code-hygiene. A related note is the appearance of using namespace in your shown code snippet. This just begs namespace collisions or unintended effects.
Slightly related: the source of the interference could have to do with pre-compiled headers. Try disabling those or making sure you know what is in the PCH header (especially on MSVC (commonly using stdafx.h) precompiled headers have some potentially surprising effects)
UPDATE
I think I spotted it: the offending code at src/geometry.cpp:213:5 calls:
assign_points(poly, shape.border);
With the types: poly is
boost::geometry::model::polygon<boost::geometry::model::d2::point_xy<double, boost::geometry::cs::cartesian>, true, true, std::vector, std::vector, std::allocator, std::allocator>,
That's the polygon typedef you show above. But shape.border is:
std::__1::vector<std::__1::vector<float, std::__1::allocator<float>>, std::__1::allocator<std::__1::vector<float, std::__1::allocator<float>>>>>
That's just vector<std::vector<float> >. That's not a supported Geometry.

Boost compilation error under OS X 10.8.5

I have an issue trying to compile a project under Mac OS X 10.8.5 using Boost libraries, version 1.34.1. I am using Xcode 4.6.3 and accompanying Command Line Tools. This must be an OS X specific issue, since the project compiles under CentOS Linux.
I am asking this here in hopes that someone has used Boost in OS X development and has maybe come across a similar issue.
I attach an excerpt of the compiler messages below. I have tried googling for the error, but can't seem to find satisfying answers. Please let me know if you can think of something from the top of your head or, which is more likely, if you need more info (e.g., source code excerpts) to be able to help me.
Thank you very much,
Best,
Sebastian
g++ -DPARC -DCPPPA_EXPORT= -fPIC -fno-common -D__STDC_LIMIT_MACROS -g -fno-inline -Wpointer-arith -Wwrite-strings -Wno-deprecated -Wreturn-type -W -I/usr/local/include -O2 -I../../src/include -I../../LexBase/src -I/include -I/usr/local/include/boost-1_34_1 -I/Users/sebastiansulger/projects/xle/dev/xfr/src/../../bgdb -Idb_client -I./ -I../include -Ifacts -Irules -Ichoices -Iterms -Imatches -Idriver -Iparser -Itriples -Iprolog -Idebug -Inew_parser -o terms/TermStorage.o -c terms/TermStorage.cpp
In file included from terms/TermStorage.cpp:9:
In file included from terms/TermStorage.h:28:
In file included from ./Types.h:26:
In file included from /usr/local/include/boost-1_34_1/boost/functional/hash.hpp:10:
/usr/local/include/boost-1_34_1/boost/functional/hash/hash.hpp:487:20: error:
call to 'hash_value' is ambiguous
return hash_value(val);
^~~~~~~~~~
/usr/include/c++/4.2.1/ext/hashtable.h:595:16: note: in instantiation of member
function 'boost::hash<long long>::operator()' requested here
{ return _M_hash(__key) % __n; }
^
/usr/include/c++/4.2.1/ext/hashtable.h:587:16: note: in instantiation of member
function '__gnu_cxx::hashtable<std::pair<const long long, unsigned int>,
long long, boost::hash<long long>, std::_Select1st<std::pair<const long
long, unsigned int> >, std::equal_to<long long>, std::allocator<unsigned
int> >::_M_bkt_num_key' requested here
{ return _M_bkt_num_key(__key, _M_buckets.size()); }
^
/usr/include/c++/4.2.1/ext/hashtable.h:522:18: note: in instantiation of member
function '__gnu_cxx::hashtable<std::pair<const long long, unsigned int>,
long long, boost::hash<long long>, std::_Select1st<std::pair<const long
long, unsigned int> >, std::equal_to<long long>, std::allocator<unsigned
int> >::_M_bkt_num_key' requested here
size_type __n = _M_bkt_num_key(__key);
^
/usr/include/c++/4.2.1/ext/hash_map:219:22: note: in instantiation of member
function '__gnu_cxx::hashtable<std::pair<const long long, unsigned int>,
long long, boost::hash<long long>, std::_Select1st<std::pair<const long
long, unsigned int> >, std::equal_to<long long>, std::allocator<unsigned
int> >::find' requested here
{ return _M_ht.find(__key); }
^
terms/TermStorage.h:97:46: note: in instantiation of member function
'__gnu_cxx::hash_map<long long, unsigned int, boost::hash<long long>,
std::equal_to<long long>, std::allocator<unsigned int> >::find' requested
here
TsHashMapIter iter = mParent->mHashMap.find(t);
^
terms/TermStorage.cpp:85:47: note: in instantiation of member function
'powerset::xfr::TermHashStorage<long long>::hashInsert' requested here
uint32_t index = (uint32_t) mIntTermStorage.hashInsert(intVal);
^
/usr/local/include/boost-1_34_1/boost/functional/hash/hash.hpp:105:24: note:
candidate function
inline std::size_t hash_value(int v)
^
/usr/local/include/boost-1_34_1/boost/functional/hash/hash.hpp:110:24: note:
candidate function
inline std::size_t hash_value(unsigned int v)
^
/usr/local/include/boost-1_34_1/boost/functional/hash/hash.hpp:115:24: note:
candidate function
inline std::size_t hash_value(long v)
^
/usr/local/include/boost-1_34_1/boost/functional/hash/hash.hpp:120:24: note:
candidate function
inline std::size_t hash_value(unsigned long v)
^
/usr/local/include/boost-1_34_1/boost/functional/hash/hash.hpp:229:24: note:
candidate function
inline std::size_t hash_value(float v)
^
/usr/local/include/boost-1_34_1/boost/functional/hash/hash.hpp:234:24: note:
candidate function
inline std::size_t hash_value(double v)
^
/usr/local/include/boost-1_34_1/boost/functional/hash/hash.hpp:239:24: note:
candidate function
inline std::size_t hash_value(long double v)
^
1 error generated.
make[1]: *** [terms/TermStorage.o] Error 1
make: *** [build] Error 2
Sebastian-Sulgers-MacBook-Pro:dev sebastiansulger$
EDIT: I have noticed that boost/functional/hash/hash.hpp includes the following:
#if defined(BOOST_HAS_LONG_LONG) && defined(_M_X64) && defined(_WIN64)
// On 64-bit windows std::size_t is a typedef for unsigned long long, which
// isn't due to be supported until Boost 1.35. So add support here.
// (Technically, Boost.Hash isn't actually documented as supporting
// std::size_t. But it would be pretty silly not to).
std::size_t hash_value(long long);
std::size_t hash_value(unsigned long long);
#endif
So it seems that the definition of the type is there, but not available for my system. Does that make any sense? Can I circumvent this somehow?
It basically says that there are lots of hash_value functions in hash.hpp, but none of them works for the type in your hash table (apparently long long).
Either your tools are too old for that type, or you don't compile with the proper -std=... parameter for the compiler.

boost mpl fold placeholder expression fails to compile

I'm trying to compile the Statemachine example from boost-mpl (located in libs/mpl/examples/fsm/player2.cpp), but it fails with boost version 1.37 and g++ 4.8.2. With boost version 1.56 and the same compiler, the build succeeds. Unfortunately, due to some platform constraints, I cannot switch to version 1.56.
I'm not expecting anyone to look into the above mentioned lengthy example, therefore I identified a minimal code snippet which illustrates the problem:
#include <boost/mpl/fold.hpp>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/placeholders.hpp>
namespace mpl = boost::mpl;
using namespace mpl::placeholders;
//Basic queue datatype
template< class CURRENT, class NEXT >
struct queue_element
{
typedef typename CURRENT::mytype mytype;
};
//type to be put at the end of the queue
struct default_queue_element
{
};
template <class TYPE>
struct wrapper{
typedef TYPE mytype;
};
typedef mpl::vector<wrapper<int>, wrapper<char> > myvector;
//the following fold expression should create this type:
typedef queue_element<wrapper<char>, queue_element<wrapper<int>,
default_queue_element> > this_type_should_be_created;
//This typedef fails to compile with boost Version 1.37,
//but works perfectly with version 1.56
typedef typename
mpl::fold<
myvector
,default_queue_element
,queue_element<_2,_1>
>::type
generate_queue;
With boost 1.37, g++ issues the following errors:
foldtest2.cpp: In instantiation of ‘struct queue_element<mpl_::arg<2>, mpl_::arg<1> >’:
../boost_1_37_0/boost/mpl/aux_/preprocessed/gcc/template_arity.hpp:85:5: required from ‘const int boost::mpl::aux::template_arity_impl<queue_element<mpl_::arg<2>, mpl_::arg<1> >, 1>::value’
../boost_1_37_0/boost/mpl/aux_/preprocessed/gcc/template_arity.hpp:93:5: required from ‘const int boost::mpl::aux::template_arity<queue_element<mpl_::arg<2>, mpl_::arg<1> > >::value’
../boost_1_37_0/boost/mpl/aux_/preprocessed/gcc/template_arity.hpp:98:30: required from ‘struct boost::mpl::aux::template_arity<queue_element<mpl_::arg<2>, mpl_::arg<1> > >’
../boost_1_37_0/boost/mpl/aux_/preprocessed/gcc/apply.hpp:67:8: required from ‘struct boost::mpl::apply2<queue_element<mpl_::arg<2>, mpl_::arg<1> >, default_queue_element, wrapper<int> >’
../boost_1_37_0/boost/mpl/aux_/preprocessed/gcc/fold_impl.hpp:67:85: required from ‘struct boost::mpl::aux::fold_impl<2, boost::mpl::v_iter<boost::mpl::vector<wrapper<int>, wrapper<char> >, 0l>, boost::mpl::v_iter<boost::mpl::vector<wrapper<int>, wrapper<char> >, 2l>, default_queue_element, queue_element<mpl_::arg<2>, mpl_::arg<1> > >’
../boost_1_37_0/boost/mpl/fold.hpp:39:18: required from ‘struct boost::mpl::fold<boost::mpl::vector<wrapper<int>, wrapper<char> >, default_queue_element, queue_element<mpl_::arg<2>, mpl_::arg<1> > >’
foldtest2.cpp:39:6: required from here
foldtest2.cpp:15:38: error: no type named ‘mytype’ in ‘struct mpl_::arg<2>’
typedef typename CURRENT::mytype mytype;
Is there a work-around to make the code compile with boost 1.37? I have been searching the web for quite some time. If nevertheless the question has already been answered somewhere, I would be grateful if you could point that out.
Looks to be very simply a bug in that ancient(¹) version of boost.
A quick bisection tells me it was fixed in v1.43.0(²). Release notes don't disclose the secret, but git does:
c5621d9 MPL: merge fix for ticket #1992 boost::mpl::zip_view does not support use as a metafunction with ::type
31a2c78 MPL: merge fix for ticket #4061 [MPL] gcc-4.5 compilation problems related to arity_helper
It clearly appears to be the latter (confirmed by compiling against 31a2c78).
So your fix this single line in include/boost/mpl/aux_/template_arity.hpp(³):
sizeof(arity_helper(type_wrapper<F>(),arity_tag<N>())) - 1
should be
sizeof(::boost::mpl::aux::arity_helper(type_wrapper<F>(),arity_tag<N>())) - 1
Of course the proper way to fix this is to use a supported version of boost
¹ (November 3rd, 2008)!!
² (May 6th, 2010)
³ warning: also present in several copies generated in preprocessed versions of the header

Are there any tools that can help me read c++ template compiling errors? [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Deciphering C++ template error messages
everytime I get this kind of template error message:
In file included from /usr/include/boost/mpl/set/aux_/iterator.hpp:19:0,
from /usr/include/boost/mpl/set/aux_/begin_end_impl.hpp:19,
from /usr/include/boost/mpl/set/set0.hpp:29,
from /usr/include/boost/parameter/aux_/set.hpp:13,
from /usr/include/boost/parameter/parameters.hpp:48,
from /usr/include/boost/accumulators/framework/accumulator_set.hpp:19,
from /usr/include/boost/accumulators/accumulators.hpp:12,
from src/SimMany.cpp:4:
/usr/include/boost/mpl/has_key.hpp: In instantiation of ‘boost::mpl::has_key<mpl_::arg<1>, mpl_::ar
g<2> >’:
/usr/include/boost/mpl/if.hpp:67:11: instantiated from ‘boost::mpl::if_<boost::mpl::has_key<mpl_:
:arg<1>, mpl_::arg<2> >, boost::mpl::identity<mpl_::arg<1> >, boost::mpl::insert<mpl_::arg<1>, boos
t::mpl::pair<mpl_::arg<2>, mpl_::arg<2> >, mpl_::na> >’
/usr/include/boost/mpl/eval_if.hpp:37:41: instantiated from ‘boost::mpl::eval_if<boost::mpl::has_
key<mpl_::arg<1>, mpl_::arg<2> >, boost::mpl::identity<mpl_::arg<1> >, boost::mpl::insert<mpl_::arg
<1>, boost::mpl::pair<mpl_::arg<2>, mpl_::arg<2> >, mpl_::na> >’
/usr/include/boost/accumulators/framework/depends_on.hpp:330:9: instantiated from ‘boost::accumul
ators::detail::insert_feature<mpl_::arg<1>, mpl_::arg<2> >’
/usr/include/boost/mpl/aux_/preprocessed/gcc/template_arity.hpp:85:5: instantiated from ‘const in
t boost::mpl::aux::template_arity_impl<boost::accumulators::detail::insert_feature<mpl_::arg<1>, mp
l_::arg<2> >, 1>::value’
/usr/include/boost/mpl/aux_/preprocessed/gcc/template_arity.hpp:93:5: instantiated from ‘const in
t boost::mpl::aux::template_arity<boost::accumulators::detail::insert_feature<mpl_::arg<1>, mpl_::a
rg<2> > >::value’
/usr/include/boost/mpl/aux_/preprocessed/gcc/template_arity.hpp:98:30: [ skipping 2 instantiation
contexts ]
/usr/include/boost/mpl/aux_/preprocessed/gcc/apply.hpp:73:1: instantiated from ‘boost::mpl::apply
2<boost::mpl::if_<boost::mpl::is_sequence<mpl_::arg<2> >, boost::accumulators::detail::insert_seque
nce<mpl_::arg<1>, mpl_::arg<2>, void>, boost::accumulators::detail::insert_feature<mpl_::arg<1>, mp
l_::arg<2> > >, boost::mpl::map0<>, boost::accumulators::tag::mean>’
/usr/include/boost/mpl/aux_/preprocessed/gcc/fold_impl.hpp:166:1: instantiated from ‘boost::mpl::
aux::fold_impl<-0x00000000000000001, boost::mpl::aux::transform_iter<boost::mpl::v_iter<boost::accu
mulators::stats<boost::accumulators::tag::mean, boost::accumulators::tag::variance(boost::accumulat
ors::lazy)>, 0l>, boost::mpl::v_iter<boost::accumulators::stats<boost::accumulators::tag::mean, boo
st::accumulators::tag::variance(boost::accumulators::lazy)>, 2l>, boost::mpl::protect<boost::mpl::b
ind1<boost::mpl::quote1<boost::accumulators::as_feature, mpl_::void_>, mpl_::arg<1> >, 0> >, boost:
:mpl::aux::transform_iter<boost::mpl::v_iter<boost::accumulators::stats<boost::accumulators::tag::m
ean, boost::accumulators::tag::variance(boost::accumulators::lazy)>, 2l>, boost::mpl::v_iter<boost:
:accumulators::stats<boost::accumulators::tag::mean, boost::accumulators::tag::variance(boost::accu
mulators::lazy)>, 2l>, boost::mpl::protect<boost::mpl::bind1<boost::mpl::quote1<boost::accumulators
::as_feature, mpl_::void_>, mpl_::arg<1> >, 0> >, boost::mpl::map0<>, boost::mpl::if_<boost::mpl::i
s_sequence<mpl_::arg<2> >, boost::accumulators::detail::insert_sequence<mpl_::arg<1>, mpl_::arg<2>,
void>, boost::accumulators::detail::insert_feature<mpl_::arg<1>, mpl_::arg<2> > > >’
/usr/include/boost/mpl/fold.hpp:39:18: instantiated from ‘boost::mpl::fold<boost::accumulators::d
etail::as_feature_list<boost::accumulators::stats<boost::accumulators::tag::mean, boost::accumulato
rs::tag::variance(boost::accumulators::lazy)>, void>, boost::mpl::map0<>, boost::mpl::if_<boost::mp
l::is_sequence<mpl_::arg<2> >, boost::accumulators::detail::insert_sequence<mpl_::arg<1>, mpl_::arg
<2>, void>, boost::accumulators::detail::insert_feature<mpl_::arg<1>, mpl_::arg<2> > > >’
/usr/include/boost/accumulators/framework/depends_on.hpp:370:13: instantiated from ‘boost::accumu
lators::detail::make_accumulator_tuple<boost::accumulators::stats<boost::accumulators::tag::mean, b
oost::accumulators::tag::variance(boost::accumulators::lazy)>, double, void>’
/usr/include/boost/accumulators/framework/accumulator_set.hpp:122:5: instantiated from ‘boost::ac
cumulators::accumulator_set<double, boost::accumulators::stats<boost::accumulators::tag::mean, boos
t::accumulators::tag::variance(boost::accumulators::lazy)> >’
src/SimMany.cpp:70:7: instantiated from here
/usr/include/boost/mpl/has_key.hpp:33:1: error: no class template named ‘apply’ in ‘struct boost::m
pl::has_key_impl<boost::mpl::non_sequence_tag>’
I get reaaaaaaally lost. I can't even visually parse where one error message starts and another ends. Are there any dev tools that can help me with this?
This gets particularly scary when I'm using boost libraries. :(
STLFilt or use different compiler. Clang has supposedly better error messages (I cannot tell for sure, I didn't used it personally)