Used for implicit mutex destruction.
~mutex ();
Destroys the mutex object.
#include <tuple> #include <string> #include <utility> int main() { std::pair<int, double> p(1, 2.0); std::tr1::tuple<long, short, std::string> t(1, 2, "hi"); bool b = p < t; }
b gets the value true.
/* The tuples implemented here are interoperable with your own tuple_like types (should you create any).
The tuple I/O manipulators:
tuple_open tuple_close tuple_delimiter
take both charT arguments and const charT* arguments. Thus you can specify multi-character braces or delimeters. This can come in handy when dealing with tuples of std::string:
*/
#include <tupleio>
#include <string>
#include <iostream>
#include <sstream>
int main()
{
std::tr1::tuple<std::string, std::string> t("Hi", "5");
std::stringstream s;
<< std::tr1::tuple_delimiter(" , ")
<< std::tr1::tuple_close(" )");
s << t << '\n';
s >> t;
std::cout << std::tr1::tuple_open("( ")
<< std::tr1::tuple_delimiter(" , ")
<< std::tr1::tuple_close(" )");
if (!s.fail())
std::cout << t << '\n';
else
std::cout << "failed\n";
}
( Hi , 5 )
/*And finally, if the TR is put into namespace std (instead of std::tr1)
<tupleio> extends I/O ability to other tuple_like types such as std::pair.
*/
#define _EWL_TR1_NAMESPACE 0
#include <tupleio>
#include <string>
#include <iostream>
#include <map>
int main()
{
typedef std::map<std::string, int> Map;
Map m;
m["one"] = 1;
m["two"] = 2;
m["three"] = 3;
std::ostream_iterator<Map::value_type> out(std::cout, "\n");
std::copy(m.begin(), m.end(), out);
}
(one 1)
(three 3)
(two 2)