I have a function void f (void*, int);, that is used as a callback function. The caller expects void (*)(int). Can I use std::bind1st to convert one to another? Is there any way to do this without using C++ 11 std::bind, just std::bind1st?
Can std::bind1st be used to convert void (*)(void*,int) to void (*)(int)?
203 Views Asked by Violet Giraffe At
1
There are 1 best solutions below
Related Questions in C++
- C++ using std::vector across boundaries
- Linked list without struct
- Connecting Signal QML to C++ (Qt5)
- how to get the reference of struct soap inherited in C++ Proxy/Service class
- Why we can't assign value to pointer
- Conversion of objects in c++
- shared_ptr: "is not a type" error
- C++ template using pointer and non pointer arguments in a QVector
- C++ SFML 2.2 vectors
- Lifetime of temporary objects
- I want to be able to use 4 different variables in a select statement in c ++
- segmentation fault: 11, extracting data in vector
- How to catch delay-import dll errors (missing dll or symbol) in MinGW(-w64)?
- How can I print all the values in this linked list inside a hash table?
- Configured TTL for A record(s) backing CNAME records
Related Questions in STDBIND
- How to pass std::bind as universal reference type?
- How do I store a vector of std::bind without a specific case for the template?
- std::bind and perfect forwarding
- std::bind fails to compile with std::atomic_bool& on MSVC
- const pointer as std::bind parameter
- Error C2668 in bind while porting from VS2008 to VS2013
- How to use template function parameter in std::bind?
- Got stack overflow when constructing std::function with std::bind result
- Can std::bind1st be used to convert void (*)(void*,int) to void (*)(int)?
- How do pass arguments to boost asio async_accept
- What the heck does std::bind(x, y) do?
- Is there a reference_wrapper<> for rvalue references?
- C++ std::bind accept typename as first argument
- Using std::bind to create a UnaryPredicate out of a BinaryPredicate to use in std::transform
- Does std::bind have boost-like overloaded operators for its result?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
No. Although
std::bind1st()creates a function object with a call operator taking andint, it is not avoid(*)(int). The only way to turn avoid(*)(void*, int)into avoid(*)(int)is to have a forwarding function which obtains thevoid*from global resources, e.g.,Anybody providing a callback which doesn't take a user-defined context, e.g., in the C-like interface a
void*which is just passed through, didn't think too hard about the interface.