Git Product home page Git Product logo

Comments (4)

jmh530 avatar jmh530 commented on August 11, 2024

Anyway, the consequence of this is that it can be hard to write a function like below that works generically with labels and const T pointers.

void foo(T, Labels...)(Slice!(const(T)*, 2u, Contiguous, Labels) a) {}

from mir-algorithm.

9il avatar 9il commented on August 11, 2024

The lables almost not implemented.

from mir-algorithm.

9il avatar 9il commented on August 11, 2024

Mit uses alias this on toConst. Maybe updating toConst could help

from mir-algorithm.

jmh530 avatar jmh530 commented on August 11, 2024

@9il After looking at it for a bit, it is starting to make a bit more sense why you did it this way. The idea is to make the whole thing const, including both values and labels.

The only thing that really jumps out is that the alias toConst this only applies for when the type is not constant. Here:
static if (!is(Slice!(const(Unqual!(PointerTarget!Iterator))*, N, kind) == This))
This only considers the case where the Iterator is const. What if the iterator is const, but the labels aren't?

And for whatever reason, this doesn't work but would make my life a lot easier if you could
void foo(T, Labels...)(Slice!(const(T)*, 2u, Contiguous, staticMap!(ConstOfUnqualOfPointerTarget, Labels)) a)

You instead have to do something like:

void foo(T)(Slice!(const(T)*, 2u, Contiguous) a) {}
void foo(T, Label1)(Slice!(const(T)*, 2u, Contiguous, const(Label1)*) a) {}
void foo(T, Label1, Label2)(Slice!(const(T)*, 2u, Contiguous, const(Label1)*, const(Label2)*) a) {}

from mir-algorithm.

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.