Comments (4)
Here is a rough draft of short-circuiting a template instantiation:
https://gist.github.com/compiletime/5c30bc18f22582cbd9e9ebb3847776d6
@ldionne If this looks like the right approach to you, would you assign this issue to me?
from hana.
Thanks for looking at this. However, let me clarify what I meant when I opened this issue. What I meant was that it should be possible for the following to only ever instantiate the left hand side:
hana::true_c || hana::any_of(some-tuple, hana::equal.to(hana::type<int>{}))
In other words, I wanted the logical operators to have short-circuitting instantiation, just like they have short-circuitting evaluation at runtime. However, the problem is that in order to even resolve which operator||
should be called, both argument types obviously need to be instantiated. This leaves us with the only option of returning some lazy compile-time boolean from hana::any_of
, so that operator||
only evaluates it when needed. However, this means that all the algorithms that return booleans would need to return that lazy boolean, and it would also require some level of interoperability with normal integral_constant
s. I'm not sure this can be achieved at all, frankly.
from hana.
Your intention is very clear now. I mistook it for short-circuiting the concept check.
from hana.
Sorry the issue was unclear at first. This was opened a long time ago when I was the only one looking at this :-). Anyway, I'll close this as I think this can't be implemented reasonably, and if constexpr
in C++17 will make some of this a non-issue (since you can nest if
s instead of relying on logical short-circuiting).
from hana.
Related Issues (20)
- Build Error C2039 with MSVC when using /std:c++latest (C++20) - std::is_literal_type removed HOT 1
- Doxygen issues HOT 1
- Get warnings with clang14 HOT 2
- Is there a replacement for fusion::nview HOT 6
- Circular dependency of boost/hana/concept/struct.hpp and boost/hana/accessors.hpp breaks tooling
- boost::hana::drop_front doesn't respect refness HOT 1
- 'apply': identifier not found inside a lambda function HOT 1
- Hana failed to build with error C2065, error C2977, error C2913... on MSVC HOT 2
- Is it possible to get back the C++ type from hana::type? HOT 1
- A proposal that works like BOOST_HANA_DEFINE/ADAPT_STRUCT and makes it 5x faster. HOT 2
- "Try it" link is broken. HOT 1
- some compile error when I use msvc2022 HOT 4
- Question: has clang __PRETTY_FUNCTION__ behavior changed in clang 16.0.0 ? HOT 1
- std::aligned_storage and std::aligned_union deprecated in C++23
- Is it possible to join two functors to one? HOT 1
- Integrate boost::pfr into hana
- Hana build failed due to fatal error C1189: #error: "No support for this compiler."
- Strange behavior of `hana::partial`
- `hana::any_of()/if_()` example code fails on the latest MSVC HOT 3
- hana::less does not work for adapted structs HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hana.