Questions tagged [invocable]

9 questions
15
votes
2 answers

How do we test if an expression of a certain type can be invoked with a prvalue?

With c++17 we have fancy new is_invocable and fancy new prvalues that aren't really values. This permits you to create an object without having to first logically construct it, then elide the construction. I have run into a problem where using…
Yakk - Adam Nevraumont
  • 262,606
  • 27
  • 330
  • 524
5
votes
1 answer

Why is std::invocable concept blocking this code from compiling

I do not understand why neither the lambda nor the function are recognized as an std::invocable compliant types in the following code: #include #include void f( std::invocable auto callback) { callback(47); } void…
nyarlathotep108
  • 5,275
  • 2
  • 26
  • 64
4
votes
1 answer

Bug in C++20 concepts with template member functions and std::invocable

I was experimenting with C++20 concepts and the Eigen library, and I incurred an unexpected behavior. Specifically, consider the following concept requiring a type to be callable with either an Eigen::Matrix> object or an…
fdev
  • 127
  • 12
3
votes
1 answer

error: conversion from 'main()::' to non-scalar type 'function' requested

In the following snippet I try to convert a lambda to my own function object, constraining it with a concept based on the invocable_r type trait. Yet gcc rejects it. Demo #include #include template
glades
  • 3,778
  • 1
  • 12
  • 34
2
votes
2 answers

how to specify C++ callable concept when the callable parameters types are deduced

I invoke a templated lambda from a templated function, the lambda parameters type are deduced. If the type of the lambda if auto, it works : https://godbolt.org/z/WYxj5G8vx #include #include #include #include…
user3897188
  • 293
  • 2
  • 6
2
votes
1 answer

is_invocable with arbitrary function argument types

Is there a way to use std::is_invocable with arbitrary function arguments types, something like: std::is_invocable. The idea is to check whether Function can accept 1 argument, regardless of the type of the argument. For a use case…
lightxbulb
  • 1,251
  • 12
  • 29
2
votes
1 answer

Unable to call an Action from Salesforce Einstein Bot

I am working on my first Salesforce Einstein Bot in a sandbox. The bot works well and navigates through multiple dialogs as intended until I try to call an Action. If I try to call any action, no matter how simple, the bot automatically ends the…
0
votes
1 answer

How to identify if a method of underlying type held by a shared_ptr can be invoked with one or no parameters at compile time

Using C++ 17. I have the following: template using ptr_t = std::shared_ptr; class some_type; class A { some_type foo() const; } class B { some_type foo() const; } class C { some_type foo(int) const; } std::variant,…
M.K.
  • 159
  • 8
0
votes
1 answer

Is there a way to convert Apex Select Statement to String

I have all the permission sets updated correctly as I i can hardcode a string 'Test' where the select statement is, but when i put in the select statement, My chat bot immediately closes. Could someone take a quick look? I am trying to test that I…