using XHANDLE = std::unique_ptr<void, decltype([]( void *h ) { h != INVALID_HANDLE_VALUE && h && CloseHandle( h ); })>;
A Win32 HANDLE-wrapper in just one line in C++20.
C++20 allows lambdas in an unevaluated context.
On 2023-11-05, Bonita Montero <[email protected]> wrote:
using XHANDLE = std::unique_ptr<void, decltype([]( void *h ) { h !=
INVALID_HANDLE_VALUE && h && CloseHandle( h ); })>;
A Win32 HANDLE-wrapper in just one line in C++20.
C++20 allows lambdas in an unevaluated context.
So what?
1960 Lisp allows lambdas in unevaluated context.
(QUOTE (LAMBDA (H)
(AND (NOT (INVALIDHANDLE H))
(CLOSEHANDLE H))))
This is just C++ catching up to something that existed when
Stroustrup was in elementary school.
Kaz Kylheku <[email protected]> writes:
On 2023-11-05, Bonita Montero <[email protected]> wrote:
using XHANDLE = std::unique_ptr<void, decltype([]( void *h ) { h !=
INVALID_HANDLE_VALUE && h && CloseHandle( h ); })>;
A Win32 HANDLE-wrapper in just one line in C++20.
C++20 allows lambdas in an unevaluated context.
So what?
1960 Lisp allows lambdas in unevaluated context.
(QUOTE (LAMBDA (H)
(AND (NOT (INVALIDHANDLE H))
(CLOSEHANDLE H))))
This is just C++ catching up to something that existed when
Stroustrup was in elementary school.
I was going to say the usage here is not a good look for C++. As a
language with compile-time type checking why is decltype needed? It's usually because C++ can't express the type involved any other way and
that's not something to shout about.
But then it turns out I don't know what's going on. This program:
#include <iostream>
#include <memory>
using uptr_int = std::unique_ptr<int, decltype([](int *ip) {
std::cout << "delete (" << *ip << ")\n";
})>;
int main()
{
int x = 42;
uptr_int ip(&x);
}
prints "delete (42)". Why? I thought decltype was just being used to
give a type for the std::unique_ptr template instantiation, but it seems
to supply the function too. What's going on?
Having used C++ from the early CFront days, and watched balloon in size
and complexity, I knew the day would come when even a short C++ program
would be mystery to me. That day has come!
On 2023-11-05, Bonita Montero <[email protected]> wrote:
using XHANDLE = std::unique_ptr<void, decltype([]( void *h ) { h !=
INVALID_HANDLE_VALUE && h && CloseHandle( h ); })>;
A Win32 HANDLE-wrapper in just one line in C++20.
C++20 allows lambdas in an unevaluated context.
So what?
1960 Lisp allows lambdas in unevaluated context.
(QUOTE (LAMBDA (H)
(AND (NOT (INVALIDHANDLE H))
(CLOSEHANDLE H))))
(QUOTE (LAMBDA (H)
(AND (NOT (INVALIDHANDLE H))
(CLOSEHANDLE H))))
This is figuratively the definition of a lambda in C++,
but not the derivation of the type, which then maintains
the identity of the call operator.
On 2023-11-06, Bonita Montero <[email protected]> wrote:
(QUOTE (LAMBDA (H)
(AND (NOT (INVALIDHANDLE H))
(CLOSEHANDLE H))))
This is figuratively the definition of a lambda in C++,
but not the derivation of the type, which then maintains
the identity of the call operator.
This smells like AI-generated word salad?
Aha!
MORON AI BOT NET
||||| || B|| |||
||||| || O| |||
||||| || | N||
||||| |I | ||
||||| | | |T
||||| A | |
M|||| | |
O||| | |
||N | |
|| T |
|| E
R|
O
If you don't understand the meaning its moronic. You've shown^^^
On 2023-11-06, Bonita Montero <[email protected]> wrote:
If you don't understand the meaning its moronic. You've shown^^^
pron. possessive + be -> contr.
he his he is -> he's
she her(s) she is -> she's
you your(s) you are -> you're
it its it is -> it's
What language model are you using?
I can imagine
On 2023-11-06, Bonita Montero <[email protected]> wrote:
(QUOTE (LAMBDA (H)
(AND (NOT (INVALIDHANDLE H))
(CLOSEHANDLE H))))
This is figuratively the definition of a lambda in C++,
but not the derivation of the type, which then maintains
the identity of the call operator.
This smells like AI-generated word salad?
Aha!
MORON AI BOT NET
||||| || B|| |||
||||| || O| |||
||||| || | N||
||||| |I | ||
||||| | | |T
||||| A | |
M|||| | |
O||| | |
||N | |
|| T |
|| E
R|
O
On 2023-11-06, Bonita Montero <[email protected]> wrote:
I can imagine
I've not seen evidence to support this.
| Sysop: | Keyop |
|---|---|
| Location: | Huddersfield, West Yorkshire, UK |
| Users: | 715 |
| Nodes: | 16 (2 / 14) |
| Uptime: | 153:02:34 |
| Calls: | 12,091 |
| Calls today: | 4 |
| Files: | 15,000 |
| Messages: | 6,517,664 |