From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31371 invoked by alias); 27 Oct 2004 11:37:34 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 31362 invoked by uid 48); 27 Oct 2004 11:37:32 -0000 Date: Wed, 27 Oct 2004 11:37:00 -0000 From: "Number_42 at caramail dot com" To: gcc-bugs@gcc.gnu.org Message-ID: <20041027113717.18174.Number_42@caramail.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug libstdc++/18174] New: documentation example for std::priority_queue usage X-Bugzilla-Reason: CC X-SW-Source: 2004-10/txt/msg03293.txt.bz2 List-Id: I just wanted to add an std::priority_queue usage example in the documentations, since it's not obvious when you don't know how tu use it. Since there isn't an "html" target in the root Makefile of gcc i didn't check for validity of the patch, but i think it's ok. $ uuencode priority_queue-3.4.1.patch.uu < priority_queue-3.4.1.patch begin 600 priority_queue-3.4.1.patch.uu M9&EF9B`MPHK("`@*B`@ M<'5B;&EC.@HK("`@*B`@("`@($EN="AI;G0@:2D**R`@("H@("`@("`@("`@ M.B!I7RAI*0HK("`@*B`@("`@('L**R`@("H@("`@("!]"BL@("`J"BL@("`J M("`@("`@:6YT(&E?.PHK("`@*B`@?3L**R`@("H**R`@("H@('-T9#HZ;W-T M7!E9&5F('-T9#HZ<')I M;W)I='E?<75E=64\($EN="`J+"!V96-T;W)?='EP92P@26YT7VQE5]Q=65U95]T>7!E.PHK("`@*@HK("`@*B`@=F]I9`HK("`@*B`@ M9F]O*"D**R`@("H@('L**R`@("H@("`@("!V96-T;W)?='EP92!V.PHK("`@ M*@HK("`@*B`@("`@('8N<'5S:%]B86-K*&YE=R!);G0H."DI.PHK("`@*B`@ M("`@('8N<'5S:%]B86-K*&YE=R!);G0H,2DI.PHK("`@*B`@("`@('8N<'5S M:%]B86-K*&YE=R!);G0H-2DI.PHK("`@*@HK("`@*B`@("`@('!R:6]R:71Y M7W%U975E7W1Y<&4@<'$H=BYB96=I;B@I+"!V+F5N9"@I*3L**R`@("H**R`@ M("H@("`@("!W:&EL92`H(7!Q+F5M<'1Y*"DI"BL@("`J("`@("`@>PHK("`@ M*B`@("`@("`@("!S=&0Z.F-O=70@/#P@*G!Q+G1O<"@I(#P\('-T9#HZ96YD M;#L**R`@("H@("`@("`@("`@9&5L971E('!Q+G1O<"@I.PHK("`@*B`@("`@ M("`@("!P<2YP;W`H*3L**R`@("H@("`@("!]"BL@("`J("!]"BL@("`J("!< M96YD8V]D90HK("`@*B\*("`@=&5M<&QA=&4\='EP96YA;64@7U1P+"!T>7!E H;F%M92!?4V5Q=65N8V4^"B`@("`@8VQA + * #include + * #include + * + * class Int + * { + * public: + * Int(int i) + * : i_(i) + * { + * } + * + * int i_; + * }; + * + * std::ostream & + * operator<< (std::ostream & os, const Int & i) + * { + * return os << i.i_; + * } + * + * class Int_less + * { + * public: + * // Function operator + * bool operator() (const Int * i1, const Int * i2) + * { + * return i1->i_ < i2->i_; + * } + * }; + * + * typedef std::vector< Int * > vector_type; + * typedef std::priority_queue< Int *, vector_type, Int_less > priority_queue_type; + * + * void + * foo() + * { + * vector_type v; + * + * v.push_back(new Int(8)); + * v.push_back(new Int(1)); + * v.push_back(new Int(5)); + * + * priority_queue_type pq(v.begin(), v.end()); + * + * while (!pq.empty()) + * { + * std::cout << *pq.top() << std::endl; + * delete pq.top(); + * pq.pop(); + * } + * } + * \endcode + */ template class queue { HTH -- Summary: documentation example for std::priority_queue usage Product: gcc Version: 3.4.1 Status: UNCONFIRMED Severity: enhancement Priority: P2 Component: libstdc++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: Number_42 at caramail dot com CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: all GCC host triplet: all GCC target triplet: all http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18174