Map two integers to another integer [closed] - c++

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have two integers and I want to create a hash map which maps the two integers to another integer.
In order to so I created the following program, however it is giving me errors:
#include <iostream>
#include <unordered_map>
using namespace std;
int main()
{
std::pair <int, int> var1;
var1=std::make_pair(10,20);
cout<<"\n var1.f="<<var1.first<<"\t 2."<<var1.second<<"\n";
std::unordered_map <std::pair <int,int>, int> yeah;
return 0;
}
Is there some way to get rid of the errors?
Is there some way to do the same in a scalable manner?
Error:
n file included from /usr/local/gcc-4.8.1/include/c++/4.8.1/bits/hashtable.h:35:0,
from /usr/local/gcc-4.8.1/include/c++/4.8.1/unordered_map:47,
from main.cpp:2:
/usr/local/gcc-4.8.1/include/c++/4.8.1/bits/hashtable_policy.h: In instantiation of ‘struct std::__detail::_Hash_code_base<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::__detail::_Select1st, std::hash<std::pair<int, int> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, true>’:
/usr/local/gcc-4.8.1/include/c++/4.8.1/bits/hashtable_policy.h:1402:10: required from ‘struct std::__detail::_Hashtable_base<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::__detail::_Select1st, std::equal_to<std::pair<int, int> >, std::hash<std::pair<int, int> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Hashtable_traits<true, false, true> >’
/usr/local/gcc-4.8.1/include/c++/4.8.1/bits/hashtable.h:174:11: required from ‘class std::_Hashtable<std::pair<int, int>, std::pair<const std::pair<int, int>, int>, std::allocator<std::pair<const std::pair<int, int>, int> >, std::__detail::_Select1st, std::equal_to<std::pair<int, int> >, std::hash<std::pair<int, int> >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >’
/usr/local/gcc-4.8.1/include/c++/4.8.1/bits/unordered_map.h:100:18: required from ‘class std::unordered_map<std::pair<int, int>, int>’
main.cpp:12:50: required from here
/usr/local/gcc-4.8.1/include/c++/4.8.1/bits/hashtable_policy.h:1070:12: error: invalid use of incomplete type ‘struct std::hash<std::pair<int, int> >’
struct _Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2,
^
In file included from /usr/local/gcc-4.8.1/include/c++/4.8.1/bits/basic_string.h:3033:0,
from /usr/local/gcc-4.8.1/include/c++/4.8.1/string:52,
from /usr/local/gcc-4.8.1/include/c++/4.8.1/bits/locale_classes.h:40,
from /usr/local/gcc-4.8.1/include/c++/4.8.1/bits/ios_base.h:41,
from /usr/local/gcc-4.8.1/include/c++/4.8.1/ios:42,
from /usr/local/gcc-4.8.1/include/c++/4.8.1/ostream:38,
from /usr/local/gcc-4.8.1/include/c++/4.8.1/iostream:39,
from main.cpp:1:
/usr/local/gcc-4.8.1/include/c++/4.8.1/bits/functional_hash.h:58:12: error: declaration of ‘struct std::hash<std::pair<int, int> >’
struct hash;
^
In file included from /usr/local/gcc-4.8.1/include/c++/4.8.1/bits/hashtable.h:35:0,
from /usr/local/gcc-4.8.1/include/c++/4.8.1/unordered_map:47,
from main.cpp:2:

I assume the error is something like "The C++ Standard doesn't provide a hash for this type"? The problem is that anything you use as the key in an unordered map must be hashable, and there is no built-in hash function for pair<int, int>. A couple possibilities are:
-Write your own hasher for pair<int, int> and use it as the third template parameter to the unordered_map. This post may be able to help with that.
-Use std::unordered_map<int, std::unordered_map<int, int>> instead. Be careful not to accidentally create copies of the inner map when you're performing operations.
-Use map instead of unordered_map. This will give you logarithmic operations instead of constant-time, but unless the map is huge and you're doing tons of lookups per second, you won't notice the difference.
Edit in response to your edit: Yes, that's what those error messages amount to, though they don't say it in quite as friendly a fashion as Microsoft's compiler does. :)

Related

Recursive unordered_map

I have a tree structure that internally uses unordered map
#include <unordered_map>
struct Node {
std::unordered_map<int, Node> children;
};
int main() {
Node a;
}
It works just fine on Apple clang 11.0.3 and MSVC v19.24, but it fails to compile on clang 10.0.0 and gcc 10.1
While regular std::map works just fine on all compilers. I failed to find the reason for this discrepancy. Is there any way to use std::unordered_map as a value for itself? Or pointers is the only solution here?
Here's the compiler explorer link https://godbolt.org/z/6eYch9
Here's an error from gcc:
#3 with x86-64 gcc 10.1
In file included from /opt/compiler-explorer/gcc-10.1.0/include/c++/10.1.0/unordered_map:43,
from <source>:1:
/opt/compiler-explorer/gcc-10.1.0/include/c++/10.1.0/bits/stl_pair.h:
In instantiation of 'struct std::pair<const int, Node>':
/opt/compiler-explorer/gcc-10.1.0/include/c++/10.1.0/ext/aligned_buffer.h:91:28:
required from 'struct __gnu_cxx::__aligned_buffer<std::pair<const int,
Node> >'
/opt/compiler-explorer/gcc-10.1.0/include/c++/10.1.0/bits/hashtable_policy.h:233:43:
required from 'struct
std::__detail::_Hash_node_value_base<std::pair<const int, Node> >'
/opt/compiler-explorer/gcc-10.1.0/include/c++/10.1.0/bits/hashtable_policy.h:279:12:
required from 'struct std::__detail::_Hash_node<std::pair<const int,
Node>, false>'
/opt/compiler-explorer/gcc-10.1.0/include/c++/10.1.0/bits/hashtable_policy.h:1973:13:
required from 'struct
std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<const
int, Node>, false> > >'
/opt/compiler-explorer/gcc-10.1.0/include/c++/10.1.0/bits/hashtable.h:173:11:
required from 'class std::_Hashtable<int, std::pair<const int, Node>,
std::allocator<std::pair<const int, Node> >,
std::__detail::_Select1st, std::equal_to<int>, std::hash<int>,
std::__detail::_Mod_range_hashing,
std::__detail::_Default_ranged_hash,
std::__detail::_Prime_rehash_policy,
std::__detail::_Hashtable_traits<false, false, true> >'
/opt/compiler-explorer/gcc-10.1.0/include/c++/10.1.0/bits/unordered_map.h:105:18:
required from 'class std::unordered_map<int, Node>'
<source>:4:39: required from here
/opt/compiler-explorer/gcc-10.1.0/include/c++/10.1.0/bits/stl_pair.h:218:11:
error: 'std::pair<_T1, _T2>::second' has incomplete type
218 | _T2 second; ///< The second member
| ^~~~~~
<source>:3:8: note: forward declaration of 'struct Node'
3 | struct Node {
| ^~~~
Compiler returned: 1
STL containers are not required to work with incomplete types. If you don't mind extra indirection, then the workaround is std::map<int, std::unique_ptr<Node>>
It's the same problem as doing e.g.
struct Node
{
Node child; // An instance of the full structure
};
You can't use a structure (or class) before it's fully defined, which it is at the closing }.
You can however define pointers to the structure, because then the compiler don't need the full structure definition, only know the name of the structure:
struct Node
{
Node* child; // Pointer to the structure
};
So to solve your problem, you need a map of pointers:
std::unordered_map<int, Node*> children;
Running into this while coding a Trie data structure I've noticed that in the latest of clang (v14) and GCC (v12) I don't get the error and my code operates as expected but anything below those versions (on godbolt.com) I get the same error. This is all using -std=c++14 so it's should not be related to the standard.

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.

How do I define operator >> (istream &, ...) for a standard type that lacks a pre-defined operator without extending namespace `std`?

Apparently it's Undefined Behaviour to add (almost) anything to the std namespace.
I'm using C++14 which has no std::chrono::parse() (C++20 only) but I need to deserialise values of type std::chrono::milliseconds (a specialisation of std::chrono::duration) from an istream.
Although this works, I can't find any exceptions that allow this to not be UB:
namespace std {
std::istream& operator >>(std::istream & is, std::chrono::milliseconds & ms) {
std::string s;
is >> s;
ms = std::chrono::milliseconds(std::stoi(s));
return is;
}
}
Since neither of these two parameter types are my types, I'm not sure how I'd safely define this operator outside of the std namespace.
Note that the operator will be called deep within Boost::program_options so I don't think I can define the operator in my own namespace and then use using my_ns::operator>> because the scope of that using declaration won't extend into the program_options scope.
How I Ended Up Here
As a user of Boost::program_options I have a particular configuration variable that I read from a configuration file that is stored as a std::chrono::milliseconds value:
std::chrono::milliseconds period;
po::options_description config_only_opts;
config_only_opts.add_options()
("control.period", po::value<std::chrono::milliseconds>(&period), "Specify the period in milliseconds");
// ...
auto istream = ifstream("config.cfg");
po::variables_map vm;
po::store(po::parse_config_file(istream, config_file_opts, false), vm);
According to the Boost::program_options documentation, it is possible to deserialise values from the config file for types that have an operator >> (istream &, ...) function defined.
Without the extention to std mentioned above, I end up with this kind of compiler error:
/home/david/opt/boost-1.69/include/boost/lexical_cast/detail/converter_lexical.hpp: In instantiation of ‘struct boost::detail::deduce_target_char_impl<boost::detail::deduce_character_type_later<std::chrono::duration<long int, std::ratio<1, 1000> > > >’:
/home/david/opt/boost-1.69/include/boost/lexical_cast/detail/converter_lexical.hpp:270:89: required from ‘struct boost::detail::deduce_target_char<std::chrono::duration<long int, std::ratio<1, 1000> > >’
/home/david/opt/boost-1.69/include/boost/lexical_cast/detail/converter_lexical.hpp:407:92: required from ‘struct boost::detail::lexical_cast_stream_traits<std::__cxx11::basic_string<char>, std::chrono::duration<long int, std::ratio<1, 1000> > >’
/home/david/opt/boost-1.69/include/boost/lexical_cast/detail/converter_lexical.hpp:468:15: required from ‘struct boost::detail::lexical_converter_impl<std::chrono::duration<long int, std::ratio<1, 1000> >, std::__cxx11::basic_string<char> >’
/home/david/opt/boost-1.69/include/boost/lexical_cast/try_lexical_convert.hpp:201:44: required from ‘bool boost::conversion::detail::try_lexical_convert(const Source&, Target&) [with Target = std::chrono::duration<long int, std::ratio<1, 1000> >; Source = std::__cxx11::basic_string<char>]’
/home/david/opt/boost-1.69/include/boost/lexical_cast.hpp:41:60: required from ‘Target boost::lexical_cast(const Source&) [with Target = std::chrono::duration<long int, std::ratio<1, 1000> >; Source = std::__cxx11::basic_string<char>]’
/home/david/opt/boost-1.69/include/boost/program_options/detail/value_semantic.hpp:92:36: required from ‘void boost::program_options::validate(boost::any&, const std::vector<std::__cxx11::basic_string<charT> >&, T*, long int) [with T = std::chrono::duration<long int, std::ratio<1, 1000> >; charT = char]’
/home/david/opt/boost-1.69/include/boost/program_options/detail/value_semantic.hpp:184:21: required from ‘void boost::program_options::typed_value<T, charT>::xparse(boost::any&, const std::vector<std::__cxx11::basic_string<charT> >&) const [with T = std::chrono::duration<long int, std::ratio<1, 1000> >; charT = char]’
/home/david/myproj/Config.cpp:208:1: required from here
/home/david/opt/boost-1.69/include/boost/lexical_cast/detail/converter_lexical.hpp:243:13: error: static assertion failed: Target type is neither std::istream`able nor std::wistream`able
BOOST_STATIC_ASSERT_MSG((result_t::value || boost::has_right_shift<std::basic_istream<wchar_t>, T >::value),
^
I would not recommend adding that function even if the standard allowed the operator to be overloaded. It's not a generic way to read a std::chrono::milliseconds from a std::istream. What you have is your application's own way of reading such an object from a std::istream.
I recommend adding a function in your application's own namespace.
namespace MyApp
{
std::istream& readChronoMilliSeconds(std::istream& is, std::chrono::milliseconds & ms)
{
std::string s;
is >> s;
ms = std::chrono::milliseconds(std::stoi(s));
return is;
}
}
Using fancy types for input parameter is fooling yourself because input parameters generally are nothing else than numbers, strings or lists of them.
What I recommend is to take a proper integer value and convert internally to milliseconds.
int period_in_ms = 0;
...
config_only_opts.add_options()
("control.period_in_ms", po::value<int>(&period_in_ms), "Specify the period in milliseconds");
...
auto period = std::chrono::milliseconds(period_in_ms);
You can use the "notify" mechanism in Boost.ProgramOptions to update the value of period in-place but it is not worth the trouble.
If you want to input the parameter in a certain format (e.g. finish with "ms", as in "100ms") then take a value<std::string> and make the conversion/parsing.

How to deal with way too long STL template error report?

When programming in c++ STL, or intensively using 'templatization', and some compiling error happens, often the error report is really long, and often too much not needed information is given.
I'm talking about gcc, i don't know if with other compilers is different, but some times even for just a typo, it takes a while to catch the error purging the
<ns::type<ns::type<ns::type, ns::type<...><ns::type<...> > > > >
I'm looking for some compiler flag, trick, workaround or methodology ( i currently copy past the error and put on two lines what i have and what compiler use to want and removing variables bookmarks... (kinda sad procedure for a not-so-uncommon ctrl+s non well performed)) that could make this task quicker or just helping me ( even only some IDE error syntax highlight... )
STLFilt: An STL Error Message Decryptor for C++ is a popular tool to filter these verbose error messages and turn them into something more legible.
From their website:
STLFilt was initially conceived as a teaching aid, to allow students
taking C++ and/or STL-specific workshops to make sense of typically
overbloated STL error messages. Today, however, even some C++ experts
have adopted STLFilt for use in everyday development. The results may
not always be perfect, but most of the time the information lost
during Decryption is not critical to the application being debugged.
The rest of the time, Decryption is easy enough to bypass.
The distribution for each platform (compiler/library set) is
self-contained and tuned to the idiosyncrasies of that platform. Each
Perl script performs basic regex substitutions for all the standard
(and extended, if present in the library) STL components, while
certain versions of the script go further with respect to message
ordering, line wrapping, library header error treatment, etc., as I
unilaterally deemed appropriate for that platform.
Here's a demo run that shows how it can be useful:
The source program:
#include <map>
#include <algorithm>
#include <cmath>
const int values[] = { 1,2,3,4,5 };
const int NVALS = sizeof values / sizeof (int);
int main()
{
using namespace std;
typedef map<int, double> valmap;
valmap m;
for (int i = 0; i < NVALS; i++)
m.insert(make_pair(values[i], pow(values[i], .5)));
valmap::iterator it = 100; // error
valmap::iterator it2(100); // error
m.insert(1,2); // error
return 0;
}
First, an unfiltered run using the MinGW gcc 3.2 compiler:
d:\src\cl\demo>c++2 rtmap.cpp
rtmap.cpp: In function `int main()':
rtmap.cpp:19: invalid conversion from `int' to `
std::_Rb_tree_node<std::pair<const int, double> >*'
rtmap.cpp:19: initializing argument 1 of `std::_Rb_tree_iterator<_Val, _Ref,
_Ptr>::_Rb_tree_iterator(std::_Rb_tree_node<_Val>*) [with _Val =
std::pair<const int, double>, _Ref = std::pair<const int, double>&, _Ptr =
std::pair<const int, double>*]'
rtmap.cpp:20: invalid conversion from `int' to `
std::_Rb_tree_node<std::pair<const int, double> >*'
rtmap.cpp:20: initializing argument 1 of `std::_Rb_tree_iterator<_Val, _Ref,
_Ptr>::_Rb_tree_iterator(std::_Rb_tree_node<_Val>*) [with _Val =
std::pair<const int, double>, _Ref = std::pair<const int, double>&, _Ptr =
std::pair<const int, double>*]'
E:/GCC3/include/c++/3.2/bits/stl_tree.h: In member function `void
std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::insert_unique(_II,
_II) [with _InputIterator = int, _Key = int, _Val = std::pair<const int,
double>, _KeyOfValue = std::_Select1st<std::pair<const int, double> >,
_Compare = std::less<int>, _Alloc = std::allocator<std::pair<const int,
double> >]':
E:/GCC3/include/c++/3.2/bits/stl_map.h:272: instantiated from `void std::map<_
Key, _Tp, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _Input
Iterator = int, _Key = int, _Tp = double, _Compare = std::less<int>, _Alloc = st
d::allocator<std::pair<const int, double> >]'
rtmap.cpp:21: instantiated from here
E:/GCC3/include/c++/3.2/bits/stl_tree.h:1161: invalid type argument of `unary *
'
And a filtered run using the gcc-specific Proxy c++:
d:\src\cl\demo>c++ rtmap.cpp
*** {BD Software Proxy c++ for gcc v3.01} STL Message Decryption is ON! ***
rtmap.cpp: In function `int main()':
rtmap.cpp:19: invalid conversion from `int' to `iter'
rtmap.cpp:19: initializing argument 1 of `iter(iter)'
rtmap.cpp:20: invalid conversion from `int' to `iter'
rtmap.cpp:20: initializing argument 1 of `iter(iter)'
stl_tree.h: In member function `void map<int,double>::insert_unique(_II, _II)':
[STL Decryptor: Suppressed 1 more STL standard header message]
rtmap.cpp:21: instantiated from here
stl_tree.h:1161: invalid type argument of `unary *'
STL Decryptor reminder:
Use the /hdr:L option to see all suppressed standard lib headers
[Note: demo runs were performed in an 80-column console window with
STLFilt's intelligent line wrapping enabled, and with internal
switches set to produce messages as terse as possible. More detail is
available by tailoring the Decryptor's options.]
The only downside I can see is that it mislabels the C++ Standard Library. :(
Here's a relevant journal article by STLFilt's author.
A few people have made tools to perform this, as there's nothing inbuilt. Tonnes on Google, but the top result returns: http://www.bdsoft.com/tools/stlfilt.html
It should be compatible with visual studio and gcc.
edit::
I need to type less to actually get input in time :)

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)