Hacker News new | past | comments | ask | show | jobs | submit | benjamaan's comments login

why would I lie?


Same question in chatgpt

https://chat.openai.com/share/36e9e015-8645-4c07-9131-d8d773...

Alright, let's dive into this. You're looking to modify your function to not use the `auto` keyword with parameter packs but instead use a template parameter. The thing is, when we talk about replacing `auto` with a template parameter in a situation like yours, it gets a bit tricky due to how parameter packs work with templates and concepts.

Your initial function definition is pretty sleek because it uses C++20 concepts (`std::same_as`) alongside `auto` to enforce that all arguments passed to `IsKeyDown` must be of the same type as `KeyCode`. This is cool because it gives you compile-time type checking right off the bat.

However, when you're looking to shift away from `auto` and use a template parameter list directly, you'd typically define a template that applies a concept to a type parameter. Unfortunately, the direct translation you're asking for, using `std::same_as<KeyCode>` directly in a template parameter list for a function, isn't how concepts are applied in template parameter lists. Here's how you can achieve a similar effect:

```cpp template<typename... Keys> requires (std::same_as<Keys, KeyCode> && ...) inline bool IsKeyDown(Keys... keys) { return (::IsKeyDown(KeyCodeToRaylibKey(keys)) || ...); } ```

In this version, `template<typename... Keys>` declares that `IsKeyDown` is a function template that accepts a variadic template parameter list named `Keys`. This means you can pass any number of arguments of any types to `IsKeyDown`, as long as they all meet the requirement defined by the `requires` clause that follows.

The `requires` clause here uses a fold-expression over the logical AND operator (`&&`) combined with the `std::same_as` concept to ensure that every type in `Keys` is the same as `KeyCode`. It's a way to say "all types in `Keys` must be `KeyCode`," which aligns with your original intent but doesn't use `auto`.

This approach maintains the compile-time check you wanted, ensuring all arguments to the function are of type `KeyCode`, and it doesn't use `auto` in the parameter list directly. It's a bit more verbose but achieves the goal within the constraints of the language and how templates and concepts interact.

Remember, this approach leverages C++20 features heavily, so make sure your compiler and build environment are up to date to support this syntax.



this https://www.enjoybloom.com/ - the exercises really helped me to gain mental stability and a year later I'm now flourishing from it


For context I studied mechanical engineering and have been a founding employee at two successful tech startups one mobile payments another a multinational dev recruitment marketplace - and a few others with mediocre success or exits over the last eleven years.

I’m currently on a career break and travelling in South America. It’s been worrying to step away from my career and out that gap in my cv but it’s something I did think about for pretty much all 11 years I was working and so I’m not going to look back when I’m 80 and wonder what if. And it’s been deeply restful and helped me to build confidence in who I am as a person, without hiding behind a job title.

Best investment I made was quitting drinking and drugs and getting an addictions counselor. I had taken myself to 0 financially and health wise. Doing the AA program and exploring that community helped me immensely- I love communities and I can take from programs what I need and leave the rest. Life changing book in this space to grok addiction IMO is The Biology of Desire. Not just opinions, actual neuroscience and field investigation combined from a PhD.

6 years later I have 3-4 years of runway and possible 20+ years runway in equity (at current valuations). I’m pretty fit and hike, surf and rock climb regularly. I also have amazing friendships and family relationships that I’m deeply grateful for.

Another great investment was getting a tennis coach who had broken tennis down into a cheat code of 7 rules after watching 1000s of hours of pros playing. I learned so much from his deep work making a simple “tennis principles for noobs” class. Just 7 lessons.

I have done therapy for two years recently which has felt more advanced and vague. In some areas of my life I’ve had fundamental changes in thinking that my therapist has really helped me to persevere with, without which I just wouldn’t have had the energy to keep working on. I’m still waiting to see how impactful it is - but it’s been quite a lot harder to navigate than quitting drugs because I don’t have a clear problem other than I am looking for a new direction in life.

I’ve read a ton of self help books and I’ve gleaned many principles to carry away with me. I only really return to a few of them: specifically Untethered Soul, The Courage to be Disliked and The Courage to be Happy - as does a close friend who is en route to billionaire.

Finally the best self improvement you can do is to spend time travelling, working with, socializing with or playing games with smart and driven people who are also kind, mindful. We learn fastest through experience and mirroring others and there’s no substitute from running alongside a master in something else - and sharing your experience together.


Sounds like your tennis coach should write a book.


Hey people of HackerNews. I'd love to hear how you each got into coding/tech/startups?


This reminded me of the early days of launching SnapScan. Firstly, it was about the 4th time we had rebuilt and relaunched a payments app. Then, we launched it for online payments which got absolutely zero traction.

Eventually we went and sat at weekend markets and coffee shops and spoke to customers and merchants one-by-one to explain to them everything about it: why we built it, who we were, how the security worked, where they could find us if we lost their money, how to download a mobile app, how to link a bank card to an app. We manually did this with probably over 1000 customers.

And then we gave them R50 to use it, and for the first year gave merchants the product for free.

This set us up for success. We deeply knew how customers perceived our app and using their phone to pay. We had also deeply educated a small army of people. And we had personal relationships with them, they had literally saved my number on their phone and could call me.

This article was a great reminder of the mental strain that took.


Hi I'm the Community Manager for Programmable Banking so AMA

In this Programmable Banking Community demo, OfferZen share how they built a company card spend tracking system that integrates with to help our Finance team save time managing company expenses.

I'm super excited about this because it's the first published example of how Programmable Banking can be used for with Private Banking for Business to enable companies to build fintech for themselves and their clients.


I am busy defining a role for myself within my company as a Community Engineer and wrote this little article recently to share some of my thoughts on the matter

https://news.ycombinator.com/item?id=21824495


Find people who are also pursuing long term discipline, that like to talk about it and who celebrate your own pursuit thereof. Works best if you're tied into a non-emotional relationship with them like at work.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: