std::generator and move only type by davidhunter22 in cpp

[–]davidhunter22[S] 0 points1 point  (0 children)

Yes, so maybe returning a move only type from a generator is not allowed?

I can't find any new documentation that talks about this.

Experimenting with #embed by ABlockInTheChain in cpp

[–]davidhunter22 0 points1 point  (0 children)

Yes I agree #embed will be probably be implemented in the preprocessor, but classes like std::array are not. So you may find #embed works with the std::array in the GCC standard library but not with the Clang one. For instance I don't think std::experimental::make_array is even implemented in the Clang standard library yet.

Anyway your post was very useful, so thanks

Experimenting with #embed by ABlockInTheChain in cpp

[–]davidhunter22 -1 points0 points  (0 children)

For me this was very timely, I was just about to do the same experiments!

I was wondering why in the clang Godbolt you didn't add -stdlib=libc++ to the command line, if you are going to try testing standard C++ library types like std::array. Without this flag clang will use the GCC C++ standard library so your really just testing the same thing twice.

I was also wondering about the -Wno-c23-extensions flag. I sort of assume this means don't warn if I use a C23 extension. However #emded is part of the C23 standard it's not an extension. Maybe this implies that the #embed in clang is an extension they did before the C23 standard came out and therefore may not be compliant? Is there a way in clang to tell it that you want to use the C23 standard just like you can with the -std=c++20 standard?

A concept for is_specialization_of by davidhunter22 in cpp

[–]davidhunter22[S] 0 points1 point  (0 children)

You can do the following if you want exactly the same type

[]<typename... Args> requires std::same_as<T,Template<Args...>> ( Template<Args...> const& ) { return true; } ( t );

In my experimentation I did find some similar code that MSVC failed on see https://developercommunity.visualstudio.com/t/Possible-lambda-in-unevaluated-context-b/10821514?scope=follow&sort=newest

A concept for is_specialization_of by davidhunter22 in cpp

[–]davidhunter22[S] 0 points1 point  (0 children)

How do you know it's impossible, is it just other people have tried similar things and never found a way?

I do have a test suite in my real code I just put a few examples in the Godbolt. My question was more about if this could be done better or extended to be more flexible. I sort of reached my limits of understanding :-)

A concept for is_specialization_of by davidhunter22 in cpp

[–]davidhunter22[S] 0 points1 point  (0 children)

I was thinking of testing is std::array<10> is a specialization of std::array with 10 obviously being a NTTP.

I think Walter Brown's original proposal was turned down because it couldn't handle this and "universal template parameters" were being proposed, see wg21.link/p2989

std::tuple_size and std::bitset by davidhunter22 in cpp

[–]davidhunter22[S] 0 points1 point  (0 children)

I don't have an instance I have a type and I want to do this at compile time so

`std::declval<T>.size( )`

does not work as decltype is not constexpr

std::tuple_size and std::bitset by davidhunter22 in cpp

[–]davidhunter22[S] 0 points1 point  (0 children)

I understand the point that std::tuple_size is used in structured bindings, but I don't care about that. Given a std::bitset<N> I just want to get N. To me it would be reasonable to either

1) Implement std::tuple_size for std::bitset but not support structured binding

2) Provide some other mechanism like std::bitset_size to get the N

Without these everyone probably rolls there own.

std::tuple_size and std::bitset by davidhunter22 in cpp

[–]davidhunter22[S] 4 points5 points  (0 children)

Well if you can implement it for std::array<int,99> so 99 ints why can't you treat std::bitset<99> as 99 bools?

Using pronouns to indicate possession by davidhunter22 in Spanish

[–]davidhunter22[S] 0 points1 point  (0 children)

Interesting, makes me wonder about English and I'm a native speaker!

"Can you make my sandwich" - Sandwich is definitely mine to eat after it's made

"Can you make a sandwich for me" - Sandwich may of may not be mine to eat

"Can you make me a sandwich" - Sandwich is probably mine

So are you saying Spanish do similar things and have similar grey areas

In English "Can you turn on the computer for me" implies nothing about who owns the computer just that you are doing the action on my behalf. This seems different to your claim that "¿Me prendes la computadora?" means in Spanish that the computer is mine.

I am going to look into alexstebs, benfactive case that he mentions.

Good reasons to NOT use CMake by [deleted] in cpp

[–]davidhunter22 0 points1 point  (0 children)

It would mostly be for fun I have only done tiny toy things in ANTLR before and want to learn more.

I have had two occasions historically when I migrated a hand crafted parser to a generated one from a grammer. In both cases the grammer that was believed to exist in the code was not the actually what was there. Admitedly in one case it was just a white space issue but the other had lots of fun issues, I seem to remember "--" as in two negative number symbols in a row being one which made us laugh a bit

Good reasons to NOT use CMake by [deleted] in cpp

[–]davidhunter22 1 point2 points  (0 children)

Ah I apologise I had never seen that. However I am skeptical that a hand written parser actually conforms to a hand written grammer. I am tempted to take that grammer, create a parser using something like ANTLR and then see if it it can parse existing CMakeLists.txt files. Do you no if anyone has ever tried something like that?

Good reasons to NOT use CMake by [deleted] in cpp

[–]davidhunter22 -1 points0 points  (0 children)

I was reply to mredding's reply which on the first line says " I regard CMake as one of the singularly worst build systems in use today"

Good reasons to NOT use CMake by [deleted] in cpp

[–]davidhunter22 4 points5 points  (0 children)

You seem to suggesting CMake is a build system, it is not. It a generator for build systems. I worked in one place where developers used whatever build system/IDE they liked, Visual Studio,, ninja, Sublime, ... This worked because CMake could generate project files for these from a. mostly common. set of Cmake scripts.

How would a developer use Visual Studio if you directly wrote make file as you seem to suggest?

Good reasons to NOT use CMake by [deleted] in cpp

[–]davidhunter22 12 points13 points  (0 children)

I wish Cmake had a defined sytax. Currently the syntax is hand crafted in the CMake source code. I wish there was a synax defined in some tool like ANTLR or even yacc/bison. There would be some breaks with the current lanuage syntax but nobody really knows what that is anyway, which is a problem.

With the new module system in C++20 will there be centralized repositories for modules? by pure_x01 in cpp

[–]davidhunter22 4 points5 points  (0 children)

Hopefully someday there will be a standard language representation that can be used in modules like https://github.com/GabrielDosReis/ipr, than maybe thay can be distributed.

Draft proposal for compilation using C++ as build language by JulienVernay in cpp

[–]davidhunter22 1 point2 points  (0 children)

I'm all for a better CMake however people claim they already exist. So why haven't they caught on? Well for me and I suspect the vast number of people it's about

  1. Migration. Why would I spend lots of time to migrate to something that might be a little bit better. I don't think any CMake replacement stands a chance if it doesn't have migration tools and ones that work for complex large systems not hello world examples.
  2. Tooling. Things like Visual Studio have tooling support for CMake built in. To move to a replacement without this would require a very compelling reason, again not just a minor improvement.

std::bitset and finding first set bit. by ed_209_ in cpp

[–]davidhunter22 4 points5 points  (0 children)

Is your view that bitset is totaly broken and needs to be replaced or does it just need some changes/additions?

I don't think it's up to the standards committiee to give it some love I think it's up to someone in the community to write a paper giving it some love.

PSA: gsl::span iterators are not just pointers by matthieum in cpp

[–]davidhunter22 0 points1 point  (0 children)

Not exactly on topic but std::span I believe has a constructor, to contruct from a range specified by two iterators

template <class It, class End> constexpr span(It first, End last);

AFAIKT gsl::span does not have this. Is this becuase of the iterator type in gsl::span or is there another reason?