boost-tuples

const std::map<boost::tuples::tuple, std::string>?

浪尽此生 提交于 2019-12-01 03:43:39
// BOOST Includes #include <boost/assign.hpp> // Boost::Assign #include <boost/assign/list_of.hpp> // Boost::Assign::List_Of #include <boost/assign/std/map.hpp> // Boost::Assign::Map_List_Of #include <boost/tuple/tuple.hpp> // Boost::Tuples // STD Includes #include <map> #include <vector> #include <string> // Using namespaces using namespace std; using namespace boost; using namespace boost::assign; // Consts const map<string, string> query_map = map_list_of<string, string> ("4556_SELECT_FILENAME", "SELECT FILENAME FROM Files WHERE PMU_ID = 4556") ("7552_SELECT_FILENAME", "SELECT FILENAME FROM

const std::map<boost::tuples::tuple, std::string>?

家住魔仙堡 提交于 2019-12-01 01:39:42
问题 // BOOST Includes #include <boost/assign.hpp> // Boost::Assign #include <boost/assign/list_of.hpp> // Boost::Assign::List_Of #include <boost/assign/std/map.hpp> // Boost::Assign::Map_List_Of #include <boost/tuple/tuple.hpp> // Boost::Tuples // STD Includes #include <map> #include <vector> #include <string> // Using namespaces using namespace std; using namespace boost; using namespace boost::assign; // Consts const map<string, string> query_map = map_list_of<string, string> ("4556_SELECT

Is Boost.Tuple compatible with C++0x variadic templates?

强颜欢笑 提交于 2019-11-30 15:12:18
I was playing around with variadic templates (gcc 4.5) and hit this problem : template <typename... Args> boost::tuple<Args...> my_make_tuple(Args... args) { return boost::tuple<Args...>(args...); } int main (void) { boost::tuple<int, char> t = my_make_tuple(8, 'c'); } GCC error message : sorry, unimplemented: cannot expand 'Arg ...' into a fixed-length argument list In function 'int my_make_tuple(Arg ...)' If I replace every occurrence of boost::tuple by std::tuple , it compiles fine. Is there a problem in boost tuple implementation? Or is this a gcc bug ? I must stick with Boost.Tuple for

Boost::Tuples vs Structs for return values

为君一笑 提交于 2019-11-30 06:26:22
问题 I'm trying to get my head around tuples (thanks @litb), and the common suggestion for their use is for functions returning > 1 value. This is something that I'd normally use a struct for , and I can't understand the advantages to tuples in this case - it seems an error-prone approach for the terminally lazy. Borrowing an example, I'd use this struct divide_result { int quotient; int remainder; }; Using a tuple, you'd have typedef boost::tuple<int, int> divide_result; But without reading the

Boost::Tuples vs Structs for return values

十年热恋 提交于 2019-11-28 18:33:43
I'm trying to get my head around tuples (thanks @litb), and the common suggestion for their use is for functions returning > 1 value. This is something that I'd normally use a struct for , and I can't understand the advantages to tuples in this case - it seems an error-prone approach for the terminally lazy. Borrowing an example , I'd use this struct divide_result { int quotient; int remainder; }; Using a tuple, you'd have typedef boost::tuple<int, int> divide_result; But without reading the code of the function you're calling (or the comments, if you're dumb enough to trust them) you have no