News for hackers. Stuff that matters.
Re:Cyclic dependencies are evil (2013) by im3w1l on Saturday January 30, 2021 @12:44PM (#25971112)
This resembles sql a lot. Btw I'm surprised that few languages seem to have in their standard library a many-to-many container which supports efficient lookups in either direction.
Re:Cyclic dependencies are evil (2013) by resonantjacket5 on Saturday January 30, 2021 @03:11PM (#25972516)
Actually yeah that is kinda interesting. The couple times I've had to do it, always ended up hand-rolling a 'class' with hashmaps in both directions. I wonder why few standard libraries have a both way look up structure.
Re:Cyclic dependencies are evil (2013) by iso8859-1 on Saturday January 30, 2021 @12:58PM (#25971251)
Which languages support this at all? Are you talking about ORM?
Re:Cyclic dependencies are evil (2013) by im3w1l on Saturday January 30, 2021 @01:07PM (#25971324)
I'm talking about something like this

    std::relation<Foo, Bar> foobars;
    ...
    auto& bars = foobars.forward(foo);
    ...
    auto& foos = foobars.backward(bar);
Edit: Boost apparently has it, see e.g. https://stackoverflow.com/questions/1128144/c-maps-for-many-...
Re:Cyclic dependencies are evil (2013) by gpderetta on Saturday January 30, 2021 @01:44PM (#25971701)
Boost.Bimap is a special case (and built on top) of Boost.Multiindex that allows indexing a logical table with an arbitrary subset of fields.