|
Boost : |
Subject: Re: [boost] tie alternative?
From: Delroy, Tony \(IED\) (Tony.Delroy_at_[hidden])
Date: 2008-10-27 19:58:06
-----Original Message-----
From: boost-bounces_at_[hidden]
[mailto:boost-bounces_at_[hidden]] On Behalf Of David Abrahams
Sent: Monday, 27 October 2008 12:13 PM
To: boost
Subject: [boost] tie alternative?
OK, BOOST_FOREACH aside, iterating over a range returned as a pair of
iterators can be painful and ugly:
vertex_iterator pv, ve;
tie(pv, ve) = vertices(g); // unpack the pair returned by vertices
for (vertex_iterator pv,ve = xxx(pv,vertices(g)); pv != ve; ++pv)
My only problem is how to spell xxx....
--- Prioritising (as I do) some measure of self-documentation over concision suggests something like "load_first__return_second" [footnote 1]. Compromising a bit "loadF_returnS", "pair_load_return", "load1_return2", "load_return", "load1_ret2" or even "load_ret". Abandoning my habitual use of "load" for such by-reference assignment, "pair_set_return" et al. (Usual arguments about "&pv" implications left aside.) In particular, generic words like "unpack" have too many varying behaviours in other languages and tools.... Tony [1] I'd use a double underscore, though I know technically it's reserved by the Standard - every related use I've seen involves pre- or postfix "__", and you'd have a namespace too. Having said that, I don't seriously expect anyone to agree in the boost context. -------------------------------------------------------- This is not an offer (or solicitation of an offer) to buy/sell the securities/instruments mentioned or an official confirmation. Morgan Stanley may deal as principal in or own or act as market maker for securities/instruments mentioned or may advise the issuers. This is not research and is not from MS Research but it may refer to a research analyst/research report. Unless indicated, these views are the author's and may differ from those of Morgan Stanley research or others in the Firm. We do not represent this is accurate or complete and we may not update this. Past performance is not indicative of future returns. For additional information, research reports and important disclosures, contact me or see https://secure.ms.com/servlet/cls. You should not use e-mail to request, authorize or effect the purchase or sale of any security or instrument, to send transfer instructions, or to effect any other transactions. We cannot guarantee that any such requests received via e-mail will be processed in a timely manner. This communication is solely for the addressee(s) and may contain confidential information. We do not waive confidentiality by mistransmission. Contact me if you do not wish to receive these communications. In the UK, this communication is directed in the UK to those persons who are professional and eligible counterparties (as defined in the UK Financial Services Authority's rules).
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk