operator<< for boost::any
Dear all,
I am trying to use the any class in a project. I would need to print
elements of a vector<any>. I have come to the following solution as an
example:
template<class T>
inline ostream& operator<<(ostream &os, const vector<T> &v)
{
vector<T>::const_iterator iter(v.begin());
for (int c(0), n(v.size()); c
This question recently got added to the user FAQ on the Wiki. Here's my interpretation, but I thought I would boost it here so Jeremy or others might comment.... http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?BoostUserFAQ Q How should I interpret the Boost Graph Library license? As I read it, it doesn't even look like I'm allowed to use it. Since I am looking for a graph library for use in a (semi) commercial project, this is quite important. A. There should not be a problem. Based on the 1_25_0 license it looks like: 'You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution ' Jeff
On Sat, 1 Dec 2001, Jeff Garland wrote: jeff> jeff> This question recently got added to the user FAQ on the Wiki. Here's my jeff> interpretation, but I thought I would boost it here so Jeremy or others might jeff> comment.... jeff> jeff> http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?BoostUserFAQ jeff> jeff> Q How should I interpret the Boost Graph Library license? As I jeff> read it, it doesn't even look like I'm allowed to use it. jeff> Since I am looking for a graph library for use in a (semi) jeff> commercial project, this is quite important. jeff> jeff> A. There should not be a problem. Based on the 1_25_0 license jeff> it looks like: 'You may not charge a fee for this Package jeff> itself. However, you may distribute this Package in aggregate jeff> with other (possibly commercial) programs as part of a larger jeff> (possibly commercial) software distribution ' That is correct. You are certainly allowed to use the BGL in a commercial product and redistribute it. You just can't charge a fee over and above a reasonable copying fee for the BGL itself. But you can, of course, charge whatever you want for your own software built on top of the BGL. Cheers, Jeremy ---------------------------------------------------------------------- Jeremy Siek http://php.indiana.edu/~jsiek/ Ph.D. Student, Indiana Univ. B'ton email: jsiek@osl.iu.edu C++ Booster (http://www.boost.org) office phone: (812) 855-3608 ----------------------------------------------------------------------
On 12/1/01 4:09 AM, "Patrick Guio"
I cannot get this compiled with g++ v 2.95 friend ostream& operator<<(ostream &os, const any &rhs) { return os << *any_cast<bool>(rhs); }
What's the intent of using the word "friend" here? I think that might be the problem. You can declare this function without "friend". -- Darin
On Sat, 1 Dec 2001, Darin Adler wrote:
On 12/1/01 4:09 AM, "Patrick Guio"
wrote: I cannot get this compiled with g++ v 2.95 friend ostream& operator<<(ostream &os, const any &rhs) { return os << *any_cast<bool>(rhs); }
What's the intent of using the word "friend" here? I think that might be the problem. You can declare this function without "friend".
I have tried without the friend declaration but it does not help.... Anyway, can you think of any general solution, I mean without specifying a list of ValueType ? Sincerely, Patrick
participants (4)
-
Darin Adler
-
Jeff Garland
-
Jeremy Siek
-
Patrick Guio