Git Product home page Git Product logo

Comments (6)

scheibel avatar scheibel commented on July 24, 2024

I just had a look at both code fragments.
For both errors I doesn't see any flaw in the source code; especially I don't understand the error message of the Allocator::value_type and their context.
The first error may be a misinterpretation of AppleClang regarding overloaded member functions for both const and non-const objects or a more restrictive pointer arithmetic.

I'll test on a macOS.

from cppassist.

sbusch42 avatar sbusch42 commented on July 24, 2024

Regarding the second error:
using value_type = value<T, SIMD_SIZE>;
using allocator = cppassist::aligned_allocator<T, simd_size * sizeof(T)>;
using iterator = typename std::vector<value_type, allocator>::iterator;

The value type for the vector is value_type (which is value<T, SIMD_SIZE>).
The value type for the allocator is T.

T != value<T, SIMD_SIZE), hence the error message. It can be solved syntactically by
using allocator = cppassist::aligned_allocator<value_type, simd_size * sizeof(T)>;

however I'm not sure if this is correct semantically. Should at least read sizeof(value_type), I guess?

from cppassist.

sbusch42 avatar sbusch42 commented on July 24, 2024

I don't understand the first error at all. The function that is called in non-const, so the used version of data() should also be the non-const version. But it seems like the compiler chooses the const version of data() here. I don't know what to do here except circumventing this possible compiler bug by using a const_cast.

from cppassist.

scheibel avatar scheibel commented on July 24, 2024

I just want to add that clang 3.8 (the official clang, not apple clang) has no problem with the constness.

I will provide a const_cast solution.

from cppassist.

scheibel avatar scheibel commented on July 24, 2024

Somehow, the first error vanished while fixing the second one on apple clang 8.0.

from cppassist.

sbusch42 avatar sbusch42 commented on July 24, 2024

true, it's gone. So with luck this was just a very strange follow-up bug.

from cppassist.

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.