C++11 libuv wrapper
Originally Based on "node.native" C++11 libuv wrappers
Example of use:
https://github.com/larroy/clearskies_core/blob/master/src/cs/daemon/daemon.cpp
C++11 libuv wrapper
License: MIT License
C++11 libuv wrapper
Originally Based on "node.native" C++11 libuv wrappers
Example of use:
https://github.com/larroy/clearskies_core/blob/master/src/cs/daemon/daemon.cpp
template<typename callback_t, typename ...A>
static typename std::result_of<callback_t(A...)>::type invoke(void* target, int cid, A&& ... args)
{
auto x = dynamic_cast<internal::callback_object<callback_t>*>(reinterpret_cast<callbacks*>(target)->m_lut[cid].get());
assert(x);
return x->invoke(std::forward<A>(args)...);
}
it would be better to use a boost::polymorphic_downcast
, or if you don't want the dependency on boost, add a helper function:
template <class Target, class Source>
inline Target polymorphic_downcast(Source* x)
{
assert(dynamic_cast<Target>(x) == x);
return static_cast<Target>(x);
}
template<typename callback_t, typename ...A>
static typename std::result_of<callback_t(A...)>::type invoke(void* target, int cid, A&& ... args)
{
auto x = polymorphic_downcast<internal::callback_object<callback_t>*>(reinterpret_cast<callbacks*>(target)->m_lut[cid].get());
return x->invoke(std::forward<A>(args)...);
}
Duplication of code in write
:
bool write(const std::vector<char>& buf, ...)
and bool write(const std::string& buf, ...)
should just defer to bool write(const char* buf, int len, ...)
bool write(const std::string& buf, std::function<void(error)> callback)
{
return write(buf.c_str(), buf.length(), callback);
}
bool write(const std::vector<char>& buf, std::function<void(error)> callback)
{
return write(&buf[0], buf.size(), callback);
}
I really want to help out to make this a full-fledged C++11 wrapper for libuv but I'm not sure what would be the critiera for contributing. I even use a different C++ formatting style. I noticed the following:
uvpp/error.hpp
includes <exception>
instead of stdexcept
#include <exception>
...
class exception: public std::runtime_error
std::runtime_error
is defined in <stdexcept>
not <exception>
should be:
#include <stdexcept>
...
class exception: public std::runtime_error
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.