[PPL-devel] problems with Box::operator<<

Roberto Bagnara bagnara at cs.unipr.it
Wed Jan 18 08:11:07 CET 2012


On 01/17/12 17:24, Gianluca Amato wrote:
> Hi all,
> I have a problem using operator<< with boxes. The following code does not compile with PPL 0.11.2 and gcc 4.6.1.
>
> ----
>
> #include <ppl.hh>
> #include <iostream>
>
> using namespace Parma_Polyhedra_Library;
>
> struct Floating_Point_Box_Interval_Info_Policy {
> const_bool_nodef(store_special, false);
> const_bool_nodef(store_open, true);
> const_bool_nodef(cache_empty, true);
> const_bool_nodef(cache_singleton, true);
> const_bool_nodef(cache_normalized, false);
> const_int_nodef(next_bit, 0);
> const_bool_nodef(may_be_empty, true);
> const_bool_nodef(may_contain_infinity, false);
> const_bool_nodef(check_empty_result, false);
> const_bool_nodef(check_inexact, false);
> };
>
> typedef Interval_Restriction_None<Interval_Info_Bitset
> <unsigned int,
> Floating_Point_Box_Interval_Info_Policy> >
> Floating_Point_Box_Interval_Info;
>
> typedef Box<Interval<double, Floating_Point_Box_Interval_Info> > Double_Box;
>
> int main(void) {
> Double_Box db;
> db.print();
> std::cout << db;
> return 0;
> }
>
> ---
>
> The offending line is the one with std::cout << db, which gives the following error:
>
> no match for ‘operator<<’ in ‘std::cout << db’
>
> I am not an expert neither with C++ nor with PPL, so I don't known if there is an obvious mistake in my code. Can someone give me an hint?

Hi Gianluca,

the PPL puts its overloadings of `operator<<' into namespace
Parma_Polyhedra_Library::IO_Operators, not to conflict with
the ones the client code might define.  See

   http://bugseng.com/products/ppl/documentation/user/ppl-user-0.11.2-html/namespaceParma__Polyhedra__Library_1_1IO__Operators.html

Cheers,

     Roberto

-- 
Prof. Roberto Bagnara
Applied Formal Methods Laboratory
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara at cs.unipr.it



More information about the PPL-devel mailing list