Giter Site home page Giter Site logo

Comments (15)

cmazakas avatar cmazakas commented on September 12, 2024 1

@kleunen Can I go ahead and close this issue or is there anything else you'd like to add/ask about?

from unordered.

kleunen avatar kleunen commented on September 12, 2024

I think I figured it out myself now, it seems unordered_map does not detect by itself it can use allocator traits and cxx11 construction with libc++. I had to add these defines:

#define BOOST_UNORDERED_USE_ALLOCATOR_TRAITS 1
#define BOOST_UNORDERED_CXX11_CONSTRUCTION 1
#include <boost/unordered_map.hpp>

I think it would be good to add detection of llvm libc++ to unordered_map, now that it is used more often

from unordered.

cmazakas avatar cmazakas commented on September 12, 2024

Hi kleuen!

Unfortunately, I tried recreating your issue but everything compiles:
https://godbolt.org/z/hePrb5YGq

It's not a perfect recreation of your exact setup but should be similar enough so as to trigger an error.

Could I possibly get some more information about your setup?

My question is: what compiler are you using? I'm guessing you're using Apple Clang which unfortunately I can't easily reproduce.

I'm also wondering, what C++ version? If I have more information around your compiler version and the C++ standard, I might have better luck recreating the issue.

from unordered.

kleunen avatar kleunen commented on September 12, 2024

The issue occured on the Github CI setup, so the virtual environment of Github CI with macos was used.

I am not sure what version that was, possibly this is already been updated.

from unordered.

cmazakas avatar cmazakas commented on September 12, 2024

Would you be able to provide a smaller, minimal example that causes the failure you experienced?

from unordered.

kleunen avatar kleunen commented on September 12, 2024

I have to think about that. Actually, i am not using the scoped_allocator anymore. It was easier to use a stateless allocator, so I made a workaround with a global allocator.

The example you showed was similar to the code I was using.

from unordered.

cmazakas avatar cmazakas commented on September 12, 2024

Ha ha, no worries.

You made me realize, Unordered actually doesn't have a test case like what you mentioned. So I'm going to work on adding it to the CI test matrix and then hopefully, we'll be able to trigger a failure.

from unordered.

kleunen avatar kleunen commented on September 12, 2024

If i have time, i will have a look if i can break it. I have some old test code lying around.

from unordered.

kleunen avatar kleunen commented on September 12, 2024

This was a code sample i made:
https://godbolt.org/z/9snoYPM8q

On godbolt it seems to compile fine, so maybe really related to macos ?

from unordered.

cmazakas avatar cmazakas commented on September 12, 2024

Yeah, I'm guessing it's probably some weirdness surrounding Apple Clang specifically. Maybe just not a robust enough check on the side of Unordered.

Thank you for the godbolt link!

from unordered.

kleunen avatar kleunen commented on September 12, 2024

My guess was that libc++ on macos was missing certain defines.

from unordered.

cmazakas avatar cmazakas commented on September 12, 2024

Hi @kleunen, I have a PR up: #31

Would you mind taking a look and seeing if this mirrors your use-case sufficiently simplified?

The Github Actions test matrix does include OS X and unfortunately, a compiler error doesn't seem to have been triggered.

from unordered.

kleunen avatar kleunen commented on September 12, 2024

I will have a look.

Yes, I think the macos virtual environment is probably upgraded now.
Also ubuntu 16.04 was removed recently, so.

from unordered.

kleunen avatar kleunen commented on September 12, 2024

The PR looks good. You are checking now the stateful scoped allocator is passed to the underlying vector inside the map. So, at least you have a test for this now, to make sure the C++ environment is handling this correctly.

from unordered.

cmazakas avatar cmazakas commented on September 12, 2024

Awesome, then I'll work on fixing the msvc compilation failures (so hey, at least we found one failure in the test matrix) and then we'll get this bad boy merged!

from unordered.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.