Boost logo

Boost Users :

Subject: Re: [Boost-users] multi_index:iterator_to complexity
From: Joaquin M Lopez Munoz (joaquin_at_[hidden])
Date: 2015-03-09 09:34:15


Matwey V. Kornilov <matwey.kornilov <at> gmail.com> writes:

> 09.03.2015 10:02, Joaquin M Lopez Munoz пишет:
> >
> > iterator_to does not do any kind of search based on x, but takes a
> > reference to an element of the container and returns an iterator to
> > it (roughly speaking, converts an element pointer to a node pointer).
> > [...]
>
> As far as I understand, there should be some pointer magic, like the
> following
>
> struct node {
> T obj;
> ... // Rest
> };
>
> so given x, (node*)&x will point to the struct enveloping the object and
> should provide access to index-specific data to allow iterator
> incrementation and dereferencing. What kind of additional data is stored
> in node?

None. The thing is done via some careful casting (ca™Õ°Í¼…́ѼÍÑ…ä)ݥѡ¥¸Ý¡…Ёѡ”ÍÑ…¹‘…ɐ…±±½Ý́™½È¤èÑ¡¥Ì¥ÌÑ¡”­•ä½‘”°…Ё±¥¹•Ì(ØдØ䁅¹€àÜ´ä́½˜‰½½ÍнµÕ±Ñ¥}¥¹‘•à½‘•Ñ…¥°½¥¹‘•á}¹½‘•}‰…Í”¹¡ÁÀè()ÍÑ…Ñ¥Œ¥¹‘•á}¹½‘•}‰…Í”¨™É½µ}Ù…±Õ”¡½¹ÍЁم±Õ•}ÑåÁ”¨À¤)ì(€É•ÑÕɸÍÑ…Ñ¥}…ÍÐñ¥¹‘•á}¹½‘•}‰…Í”€¨ø (€€€É•¥¹Ñ•ÉÁÉ•Ñ}…ÍÐñÁ½‘}Ù…±Õ•}¡½±‘•ÈñY…±Õ”ø¨ø €¼¨Íѐ€ä¸È¸ÄÜ€¨¼(€€€€€½¹ÍÑ}…ÍÐñÙ…±Õ•}ÑåÁ”¨ø¡À¤¤¤ì)ô()Ñ•µÁ±…Ñ”ñÑåÁ•¹…µ”9½‘”±ÑåÁ•¹…µ”Y…±Õ”ø)9½‘”¨¹½‘•}™É½µ}Ù…±Õ”¡½¹ÍЁY…±Õ”¨À¤)ì(€ÑåÁ•‘•˜ÑåÁ•¹…µ”9½‘”èé…±±½…ѽÉ}ÑåÁ”…±±½…ѽÉ}ÑåÁ”ì(€É•ÑÕɸÍÑ…Ñ¥}…ÍÐñ9½‘”¨ø (€€€¥¹‘•á}¹½‘•}‰…Í”ñY…±Õ”±…±±½…ѽÉ}ÑåÁ”øèé™É½µ}Ù…±Õ”¡À¤¤ì)ô((ø]¡…Ё$Ý…¹Ð¥ÌÑ¼Õ¹‘•ÉÍÑ…¹¥˜Ñ¡”™½±±½Ý¥¹œ½‘”¥Ì½ÉÉ•Ð…¹Ý½É­Ì(ø¥¸< Ä¤è(ø€(øl¸¸¹t(ø€€€€€€€€…ÕѼ¥Ð€ôµ…Á|¹•ÐðÄø ¤¹™¥¹¡­•ä¤ì(ø€€€€€€€€¥˜€¡¥Ð€„ôµ…Á|¹•ÐðÄø ¤¹•¹ ¤€¤âÖòævWCÃâ‚’æ—FW&F÷%÷Fò‚¦—B’ÖÖòævWCÃâ‚’æ&Vv–â‚“°£âР¥F†—2—26÷'&V7BæBv÷&·2–âòƒ’âFF—F–öæÆǒ–÷RÖ–v‡Bvç@§FòW6R&ö¦V7BÂv†–6‚—27V6–f–6ÆÇ’FW6–væVBf÷"6öçfW'F–ær—FW&F÷'0¦&WGvVVâ–æF–6W3  ¢WFò—BÒÖòævWCÃâ‚’æf–æB†¶W’“°¢–b†—BÒÖòævWCÃâ‚’æVæB‚’’°¢Öòç&ö¦V7CÃ↗B’ÖÖòævWCÃâ‚’æ&Vv–â‚“°¢Р¥W&f÷&Öæ6R—2vö–ærFò&RF†R6ÖR÷"WfVâ&WGFW"†–bF†R÷F–Ö—¦W"w0¦æ÷BFöòvööB’ÂæBF†—2—2&ö&&Ç’6ÆV&W"à ¤¦ö\:ÖâÒÌ;7W¢×\;÷ ¥FVÆVl;6æ–6


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