Boost logo

Boost Users :

Subject: Re: [Boost-users] [BGL] seg fault : more readable
From: Brian Budge (brian.budge_at_[hidden])
Date: 2009-10-22 19:08:34


At least before C++0X, a vector of references is not allowed. I'm not sure
about after C++0X (haven't dabbled much there yet).
  Brian

On Thu, Oct 22, 2009 at 3:41 PM, John Robertson <jrobertson7711_at_[hidden]>wrote:

> The following compiles and runs.
>
> typedef string Colour;
>
> struct edge_properties
> {
>
> vector < set< Colour > > eColours;
>
> }
>
>
> //get a reference to the vector of the sets of colours of some edge.
> vector < set<Colour> > & v_colour_outset =
> get(m_eColours_map,*out_iter); // Here *out_iter is some edge.
>
>
> //Add a set<Colour> to v_colour_outset ie. to get(m_eColours_map,*out_iter)
> .
> set<Colour> colour_set;
> v_colour_outset.push_back(colour_set);
>
> // get a reference to one of the set<colour> in get(m_eColours_map,*out_iter)
> .
>
> set<Colour> & outcset = v_colour_outset[1]; //or [0], or any elt.
>
> But when I try to add a new colour to this set
>
> outcset.insert("Blue");
>
> I get segfault.
> My guess is that there is a predetermined size for colour_set, and when it
> is push_backed into v_colour_outset, a new colour cannot be added into it.
>
> I tried to create a vector of set<Colour> references as follows.
>
> struct edge_properties
> {
>
> vector < set< Colour > & > eColours;
>
> }
>
> But it did not compile. ( shouldn't it? )
>
> Whats the best solution to this problem.
>
> Thanks
> - JR
>
>
> ReplyReply AllMove...InboxBGL
> Go to Previous message | Go to Next message<http://us.mc1130.mail.yahoo.com/mc/showMessage;_ylc=X3oDMTBvZ2VoZGRnBF9TAzM5ODMwMTAyNwRhYwNuZXh0TWVzZw--?pSize=50&sMid=1&fid=Sent&mid=1_3121_AFSliGIAAUORSuDSxQJTwS0pp8I&sort=date&order=down&startMid=0&.rand=908945553&filterBy=&m=1_3121_AFSliGIAAUORSuDSxQJTwS0pp8I%2C1_159_AEqliGIAATfiSs%2BJCAfcxl5bBro%2C1_550_AE%2BliGIAAKAISs97NAk8PXBN9no%2C1_915_AFaliGIAAX1mSs97DwA9ChG9zKQ%2C1_1280_AFeliGIAAUYeSs96rQeQCmduuzA%2C>| Back
> to Messages<http://us.mc1130.mail.yahoo.com/mc/showFolder;_ylc=X3oDMTBvanRicmZwBF9TAzM5ODMwMTAyNwRhYwNiYWNrRnZldw--?fid=Sent&sort=date&order=down&startMid=0&.rand=908945553&filterBy=>
> Select Message EncodingASCII (ASCII)Greek (ISO-8859-7)Greek
> (Windows-1253)Latin-10 (ISO-8859-16)Latin-3 (ISO-8859-3)Latin-6
> (ISO-8859-10)Latin-7 (ISO-8859-13)Latin-8 (ISO-8859-14)Latin-9
> (ISO-8859-15)W. European (850)W. European (CP858)W. European (HPROMAN8)W.
> European (MACROMAN8)W. European (Windows-1252)Armenia (ARMSCII-8)Baltic
> Rim (ISO-8859-4)Baltic Rim (WINDOWS-1257)Cyrillic (866)Cyrillic
> (ISO-8859-5)Cyrillic (KOI8-R)Cyrillic (KOI8-RU)Cyrillic (KOI8-T)Cyrillic
> (KOI8-U)Cyrillic (WINDOWS-1251)Latin-2 (852)Latin-2 (ISO-8859-2)Latin-2
> (WINDOWS-1250)Turkish (ISO-8859-9)Turkish (WINDOWS-1254)Arabic
> (ISO-8859-6, ASMO-708)Arabic (WINDOWS-1256)Hebrew (856)Hebrew (862)Hebrew
> (WINDOWS-1255)Chinese Simplified (GB-2312-80)Chinese Simplified (GB18030)Chinese
> Simplified (HZ-GB-2312)Chinese Simplified (ISO-2022-CN)Chinese Simplified
> (WINDOWS-936)Chinese Trad.-Hong Kong (BIG5-HKSCS)Chinese Traditional
> (BIG5)Chinese Traditional (EUC-TW)Japanese (SHIFT_JIS)Japanese (EUC-JP)Japanese
> (ISO-2022-JP)Korean (ISO-2022-KR)Korean (EUC-KR)Thai (TIS-620-2533)Thai
> (WINDOWS-874)Vietnamese (TCVN-5712)Vietnamese (VISCII)Vietnamese
> (WINDOWS-1258)Unicode (UTF-7)Unicode (UTF-8)Unicode (UTF-16)Unicode
> (UTF-32)| Full Headers<http://us.mc1130.mail.yahoo.com/mc/showMessage;_ylc=X3oDMTBvZnVubjh1BF9TAzM5ODMwMTAyNwRhYwNmdWxIZWFkcg--?sMid=0&fid=Sent&filterBy=&.rand=908945553&midIndex=0&mid=1_3437_AEqliGIAAPlNSuDedwcoI3UeiZI&f=1&m=1_3437_AEqliGIAAPlNSuDedwcoI3UeiZI%2C1_3121_AFSliGIAAUORSuDSxQJTwS0pp8I%2C1_159_AEqliGIAATfiSs%2BJCAfcxl5bBro%2C1_550_AE%2BliGIAAKAISs97NAk8PXBN9no%2C1_915_AFaliGIAAX1mSs97DwA9ChG9zKQ%2C1_1280_AFeliGIAAUYeSs96rQeQCmduuzA%2C&sort=date&order=down&startMid=0&pSize=50&hash=662aef68b7f933d737c509ba02759e8d&.jsrand=3685759&acrumb=K.EKbMWnUQD&mcrumb=erLrHYy4UH1&enc=auto&head=f>
>
> Mail Search
>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net