float and double is still not implemented for std::to_chars in GCC's STL!
So it's not working for double. Do I have to go and implement the whole thing myself now?
So it's not working for double. Do I have to go and implement the whole thing myself now?
Web++: A C++ Web Framework
Why can't we just return a "type"? wouldn't that be cooler and simplify TMP in general?
One of the alternatives to that code, is to use this "lazy evaluated" alternative to std::conditional_t.
This
- join multiple types that can be converted to strings
- it finds the best allocator among them by ranking them
- it'll only require one allocation
Here's the source: https://github.com/the-moisrex/webpp/blob/dev/core/include/webpp/strings/join.hpp
string::join will help you:- join multiple types that can be converted to strings
- it finds the best allocator among them by ranking them
- it'll only require one allocation
Here's the source: https://github.com/the-moisrex/webpp/blob/dev/core/include/webpp/strings/join.hpp
With the help of TaskWarrior and the two bash script files, gtask and gtask-markdown in the project, we can easily add the TODO table in the README.md file so every visitor can easily know about them and hopefully that'll help them to contribute more easily.
Seriously pro tip in C++20 concepts:
Do NOT use your instances of your concepts (the types that match your concepts) directly if they're going to be all over the place.
You WILL change the concept at some point. Use middle-man type aliases to extract information out of them.
Do NOT use your instances of your concepts (the types that match your concepts) directly if they're going to be all over the place.
You WILL change the concept at some point. Use middle-man type aliases to extract information out of them.
Web++: A C++ Web Framework
Seriously pro tip in C++20 concepts: Do NOT use your instances of your concepts (the types that match your concepts) directly if they're going to be all over the place. You WILL change the concept at some point. Use middle-man type aliases to extract informationβ¦
I think I should propose this to be added to the C++ Core Guideline if it's not already there.
It could get really messy if you don't follow this. Trust me, I currently getting bitten by it already! π
It could get really messy if you don't follow this. Trust me, I currently getting bitten by it already! π
You can pass
I'm using this for passing allocators in any order; there was simpler solutions for that but allocators don't usually support copy assignment operator but do support copy constructors.
std::tuple's elements in any order with this.I'm using this for passing allocators in any order; there was simpler solutions for that but allocators don't usually support copy assignment operator but do support copy constructors.
Web++: A C++ Web Framework
You can pass std::tuple's elements in any order with this. I'm using this for passing allocators in any order; there was simpler solutions for that but allocators don't usually support copy assignment operator but do support copy constructors.
It got even better than that, now it "default constructs" the ones that you didn't pass too.
But clang doesn't seem to like it. I suppose I need to extract one of those lambdas out as a struct to fix that!
It would be less pretty though :)
But clang doesn't seem to like it. I suppose I need to extract one of those lambdas out as a struct to fix that!
It would be less pretty though :)
Web++: A C++ Web Framework
It got even better than that, now it "default constructs" the ones that you didn't pass too. But clang doesn't seem to like it. I suppose I need to extract one of those lambdas out as a struct to fix that! It would be less pretty though :)
I end up doing this;
C++ is stupid π
C++ is stupid π
The choice between
1.
For the first one I have to change lots of things, but it seems more convenient choice!
What do you think?
1.
Traits and SubTraits
2. TraitsPack and Traits
seems really hard.For the first one I have to change lots of things, but it seems more convenient choice!
What do you think?
This is "Interesting, confusing, feels like it should perform better, but you know it doesn't" kinda code.
The benchmark
Inspired by: Printing 1 to 1000 without loop or conditionals
The benchmark
Inspired by: Printing 1 to 1000 without loop or conditionals
Which one is the best alternative to
With these, you can make the static_assert(false), type-dependent; thus instead of evaluating it at point of compiling the function, it gets evaluated when the function's type is known which means
And also there's a std::dependent_false proposal which in this code is an alternative for always_fasle.
Click here to see the code
static_assert(false, "oops")?With these, you can make the static_assert(false), type-dependent; thus instead of evaluating it at point of compiling the function, it gets evaluated when the function's type is known which means
if constexpr statements work in that time.And also there's a std::dependent_false proposal which in this code is an alternative for always_fasle.
Click here to see the code
Web++: A C++ Web Framework
Which one is the best alternative to static_assert(false, "oops")? With these, you can make the static_assert(false), type-dependent; thus instead of evaluating it at point of compiling the function, it gets evaluated when the function's type is known whichβ¦
There are also alternatives to the "
!sizeof(decltype(input))" part which you can see here.artificial::mind blog
always_false<T>
template <class T> struct foo { static_assert(false, "must use correct specialization"); }; template <> struct foo<int> { // valid use of foo<T> ... }; Sometimes, good intentions are punished by the compiler: <source>:4:19: error: static assertion failed:β¦