Comments (5)
Sorry to be late with an answer!
Unfortunately, I could not find a suitable solution to saved SFINAE support and returned prvalue from static constructors. I would appreciate if you help me with this. ๐
from beasthttp.
I am seeing two simple options for your use case here: the first one will require making a new template (as I'm not sure if there's an off-the-shelf definition of this one), but is conceptually direct; the second is "the minimal hack to the thing you are currently doing that will at least make it work".
- Given the following definition, you should be able to change
decltype(X, std::declval<Y>())
(which returns Y&&) totypename enable_for<X, Y>::type
(which returns Y).
template <typename Check_, typename Type_>
struct enable_for {
typedef Type_ type;
};
- I think you also should just be able to wrap your existing
decltype(X, std::declval<Y>())
intypename std::decay<...>::type
, as that will take the Y&& and decay it to Y.
-> typename std::decay<decltype(
BEASTHTTP_REACTOR_SSL_SESSION_TRY_INVOKE_FLESH_TYPE(std::declval<Router const&>()),
std::declval<context_type>())>::type
from beasthttp.
Oh wait! I'm sorry... that first suggestion is wrong as I forgot an extra level of decltype: the correct code would be typename enable_for<decltype(X), Y>::type
.
But also, in realizing the underlying mistake I made while suggesting that, it occurred to me that there's a more direct way to use the more built-in STL features.
typename stl::enable_if<(X, true), Y>::type
from beasthttp.
ok!
Replace the following macro definitions:
BEASTHTTP_REACTOR_SESSION_TRY_INVOKE_FLESH_TYPE(/*...*/)
BEASTHTTP_REACTOR_SESSION_TRY_INVOKE_FLESH_TYPE_LEGACY(/*...*/)
on this:
template<class Router, class = BEASTHTTP_REACTOR_SESSION_TRY_INVOKE_FLESH_TYPE(/*...*/)>
std::true_type try_invoke_flesh_type_helper(int);
template<class>
std::false_type try_invoke_flesh_type_helper(...);
and:
std::enable_if<decltype(try_invoke_flesh_type_helper<Router const&>(0))::value, context_type>::type
I like a second solution more, need to try it...
from beasthttp.
Thanks! I can report that the codebase (at least the parts I'm using) no longer experiences the clang-tidy warning I was reporting.
from beasthttp.
Related Issues (20)
- turn header-only to static library for saving time HOT 3
- turn on SO_REUSEADDR for listening socket (always, preferably) HOT 3
- Are there any demo examples that show the windows use cases๏ผ HOT 2
- No proper tags for releases HOT 1
- Doxygen info
- Build static libs
- add possibility of using middlewares with `use`, not only in http methods HOT 4
- Concurrency problems with router params HOT 3
- #if not defined
- ้กน็ฎ้็จๆง็้ฎ๏ผ
- Using `use` for creating modular routes results in errors.
- Error compilation on Boost version: 1.69.0 GNU 5.4.0
- [MSVC] warning C4067: unexpected tokens following preprocessor directive - expected a newline
- Windows MSVC support request
- Do not use deprecated interfaces
- Not working with Boost libraries, newer than 1.73.0
- (feature request) HTTP/2 Functionality Request HOT 1
- Trouble compliling in Ubuntu 22.04.1 LTS using gcc with Makefiles HOT 1
- Lib status?
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 beasthttp.