Coder Social home page Coder Social logo

Add missing type traits about core HOT 4 CLOSED

mnmlstc avatar mnmlstc commented on June 3, 2024
Add missing type traits

from core.

Comments (4)

bruxisma avatar bruxisma commented on June 3, 2024

common_type was implemented as it would cause an issue if given a typelist of void (even if every type was void) under libc++. Because common_type is used by the variant<Ts...> for visitation, I needed one that worked for both libc++ and libstdc++.

I should note that a majority of them were not implemented for reasons where the ::type typedef would be the actual type itself. For instance, typename std::is_constructible<T, Args...>::type is the same as std::is_constructible<T, Args...>. Additionally because I can't do something like template <class Args...> constexpr auto is_constructible_v = std::is_constructible<Args...>::value, I avoided that as well.

While some types do have the _t alias available (such as: make_signed), many of the others (such as is_null_pointer, which was added after work began on this library) do not have an equivalent alias.

I apologize if this is an inconvenience, but I will not be adding a type alias for types that resolve to std::true_type or std::false_type.

However, I'll not close this yet as is_null_pointer definitely needs to be added, and will be for 1.1.

(Please note that is_final will not be added as that is a compiler specific trait and having that specific trait suddenly break because a given compiler wasn't supported is not something that a user would enjoy)

from core.

tarqd avatar tarqd commented on June 3, 2024

Ah I see your point. I was more so suggesting it for completeness. Having the _t alias might also reduce confusion (you can just use the aliases for everything, versus taking a few brain cycles to think of which one to use).

As for common_type, is that related to this?

from core.

bruxisma avatar bruxisma commented on June 3, 2024

The common_type situation I believe was something more where T would be turned into T&&, and since you can't declare a void&&, this would cause clang on OS X to perform its best Wu-Tang Clan impression, and spit words endlessly. I do not believe that MNMLSTC Core's common_type is truly usable with SFINAE (try passing in a few lambdas to variant<Ts...>::match and watch the fireworks), but it was certainly not related to that proposal.

from core.

bruxisma avatar bruxisma commented on June 3, 2024

is_null_pointer has been added. I will now close this issue.

from core.

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.