I realized some of the things I was doing in the sample code are pretty stupid.� I'm still not sure why the compilation was failing on the phoenix code.� I'll repost once I figure out what I'm doing.� Sorry for the noise.<br> <br><br><div class="gmail_quote">On Tue, Nov 24, 2009 at 12:09 PM, James Knight <span dir="ltr"><<a href="mailto:james.nate.knight@gmail.com">james.nate.knight@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> I'm having a problem using Boost.Phoenix.� I'm currently building against Boost 1.41 using gcc 4.3.2.<br><br>I've simplified my use case quite a bit, so please forgive the obtuseness of the example.� The following code fails to compile:<br> <br>~~~~~~~~~~~~~~~~~~~~<br><br>#include <boost/fusion/include/std_pair.hpp>���� <br>#include <boost/spirit/home/phoenix/core/argument.hpp>���� <br>#include <boost/spirit/home/phoenix/fusion.hpp>���������������������� <br> #include <boost/spirit/home/phoenix/operator.hpp>���� <br>��������������������������������������������������������������������� <br>#include <vector>�������������������������������������������������������������������������������������� <br> #include <map>������������������������������������������������������������������ <br>#include <algorithm>������������� <br>��������������������������������������� <br>namespace phx = boost::phoenix;�������������������������� <br> using namespace phx::arg_names;���������� <br>using phx::at_c;����������������� <br>using std::map;������������������������������������������������������������ <br>using std::multimap;��������������������������������������������������� <br> using std::vector;������������������������ <br>�������������������������������������������������� <br>int main()�������������� <br>{������������������������������������������������������������������������������������������������������ <br> ��� typedef map<vector<char>,int> char_int_map_t;������������������������������������������������������ <br>��� typedef multimap<int,char_int_map_t::iterator> int_iter_map_t;������������������������������������� <br> ��� typedef map<vector<char>, char_int_map_t::iterator> char_iter_map_t;������������������������������� <br>������������������������������������������������������������������������������������������������������� <br> ��� int int_key = 5;����������������������������������������������������������������������������������� <br>������������������������������������������������������������������������������������������������������� <br>��� char_int_map_t int_map;���������������������������������������������������������������������������� <br> ��� int_iter_map_t int_iter_map;����������������������������������������������������������������������� <br>������������������������������������������������������������������������������������������������������� <br>��� char_iter_map_t char_iter_map1, char_iter_map_t2;�������������������������������������������������� <br> ������������������������������������������������������������������������������������������������������� <br>��� int_iter_map_t::iterator start,stop;��������������������������������������������������������������� <br>��� std::pair<int_iter_map_t::iterator,int_iter_map_t::iterator>��������������������������������������� <br> ������� er = int_iter_map.equal_range(int_key);��� <br>������������������ <br>��� std::set_intersection(��� <br>������� char_iter_map1.begin(), char_iter_map1.end(),��� <br>������� er.first,er.second,��� <br>������� inserter(char_iter_map_t2,char_iter_map_t2.begin()),��� <br> ������� phx::at_c<0>(arg1) < phx::at_c<0>(*phx::at_c<1>(arg2))��� // <- COMPILE FAILURE<br>��� );���������������������������������������������� <br>} <br><br>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br> <br> Here is the information I can offer,<br><br>1) When the key in char_int_map_t and char_iter_map_t is a char rather than a vector<char> this compiles without problems.<br>2) The gcc error shows that the arguments to the generated function object are being switched (I think, see below)<br> <br>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br>...<br>.../comparison.hpp:29:5: error: no match for �operator<� in �result_of_less<const int&, const vector<char>&>::x < result_of_less<const int&, const vector<char>&>::y� <br> .../comparison.hpp: In instantiation of �const int result_of_less<const int&, const vector<char>&>::index�:<br>.../comparison.hpp:29:�� instantiated from �result_of_less<const int&, const vector<char>&>�<br> .../mpl/eval_if.hpp:38:�� instantiated from �eval_if<or_<is_actor<const int&>, is_actor<const vector<char>&>, mpl_::bool_<false>, mpl_::bool_<false>, mpl_::bool_<false> >, re_curry<less_eval, const int&, const vector<char>&>, result_of_less<const int&, const vector<char, allocator<char> >&> >�<br> .../comparison.hpp:39:�� instantiated from �<br><br>boost::phoenix::less_eval::result<<br>��� boost::phoenix::basic_environment<<br>������� std::pair<������������������������������������������������������������������������������ // This should be the second argument, no?<br> ����������� const int,���������������������������������������������������������������������������� <br>����������� std::_Rb_tree_iterator<std::pair<const std::vector<char, std::allocator<char> >, int>>�� <br> ������� >,� <br>������� std::pair<<br>����������� const std::vector< char, std::allocator<char> >,<br>����������� std::_Rb_tree_iterator<std::pair<const std::vector<char, std::allocator<char> >, int>>�� <br> ������� >�� <br>��� >,� <br>��� boost::phoenix::composite<<br>������� boost::phoenix::at_eval<0>, <br>������� boost::fusion::vector<<br>����������� boost::phoenix::argument<0><br>������� >�� <br> ��� >,� <br>��� boost::phoenix::composite<<br>������� boost::phoenix::at_eval<0>, <br>������� boost::fusion::vector<<br>����������� boost::phoenix::composite<<br>��������������� boost::phoenix::dereference_eval, <br> ��������������� boost::fusion::vector<<br>������������������� boost::phoenix::composite<<br>����������������������� boost::phoenix::at_eval<1>, <br>����������������������� boost::fusion::vector<<br>��������������������������� boost::phoenix::argument<1><br> ����������������������� >�� <br>������������������� >�� <br>��������������� >�� <br>����������� >�� <br>������� >�� <br>��� >�� <br>><br>~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br><br>3) Finally, if I use the expression<br> <br>��� phx::at_c<0>(arg1) < *phx::at_c<1>(arg2)<br><br>the code still fails to compile (obviously), but does seem to get the arguments in the correct order.<br><br>Any ideas?<br><br>Thanks<br>Nate<br> </blockquote></div><br>