Code Monkey home page Code Monkey logo

uvpp's Introduction

uvpp's People

Contributors

germanosin avatar larroy avatar rjktcby avatar sryio avatar ssmallwinds avatar vitalyisaev2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

uvpp's Issues

incorrect include in `uvpp/error.hpp`

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 

release mode dynamic_cast in callback.hpp

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)...);
}

stream::write - should be implemented in terms of write(char*, int)

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);
    }

Contributing Guide?

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:

  • 4 spaces for indenting
  • K&R style formatting

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.