Coder Social home page Coder Social logo

moe's Introduction

相比上版本改动

此节为Moe库NakagawaNatsuki版本相比KousakaReina版本的变动说明。

在KousakaReina版本,我设计了非常多的用于更好地C++编程的组件,但是在后续的调查中,我发现我的设计远不如目前已有库(如boost库、fmtlib/fmt库)设计优秀,而这个库的根本用处是为了方便编程,既然我的设计不如已有库,那就不应该重复设计,遂删除了这些设计。

目前已经决定删除的模块和用于替代的选项:

  • decorator全模块和fmt_string全模块:可以使用fmtlib/fmt替代,他们的实现考虑更多且更通用。
  • log全模块:可以使用boost.log替代。
  • arg_parser全模块:可以使用boost.Program_options替代。
  • stl_pro以下部分模块:
    • concat_all函数:可以使用fmtlib/fmt替代。
    • split_string_on_char函数:参考这个教程,可以使用boost::split替代。
    • sub_vector函数:没啥用的函数。。。
  • time_pro:参考这个教程,可以使用boost.Posix_Time替代。

保留的模块,包括为何保留及改进的部分:

  • rt_check:建议用boost.Assert替代assert宏。至于todo宏,我用google等搜索引擎找了下,似乎没有什么库有做todo宏,所以这里就保留下来了。

    改进:增加了运行时警告moe_rt_warning宏,在运行时输出位置和警告信息。

  • restorer全模块:这个需求终究比较小众,所以保留了下来。

    改进:修复了之前一行不能有两个moe_r_set的问题,现在moe_r_set可以在同一行了。

    增加defer:在这个里面增加了moe_defer宏,具体作用就是:在当前作用域结束后,执行moe_defer里面的内容。

  • moe_typedef全模块:这也是一个小众需求,所以保留了下来。

    改进:现在moe_typedefmoe::itype这个namespace下了。

  • stl_pro以下模块:

    • enum_in函数:其他库大多转入了利用反射的enum(比如Boost.Describe),但是对于一般的enum,这个函数还是很有用的。
  • moe_concept全模块和empty_func全模块:小众需求。

  • debugger全模块:这个本身就是搬运的别的库,设计非常优秀,且那个源就是全网star比较高的一个实现Rust-like dbg的repo,故保留。

  • moe_macro全模块:辅助模块,其他的模块必须要的。

    改进:

    • 增加了_moe_cVar宏,表示无意义的变量(比如用在moe_defer宏里)。
    • 改变了MOE_CODE_POS宏展开之后的样子,现在它可以在CLion中被识别及点进。

如何使用

To use this library with CMake, just clone this repo to the root of your project (we call it projRoot), and add these statements to your projRoot/CMakeLists.txt:

add_subdirectory(./moe)
include_directories(./moe)

And add content below to your target.

target_link_libraries(YOUR_TARGET moe)

And then you can use #include <moe/decorator.hpp>

If you don't want moe_demo be one of your targets, just delete last two line of moe/CMakeLists.txt.

moe's People

Contributors

ipchrislee avatar

Stargazers

_qdd avatar Xianhao Yu avatar Yuxiao Wang avatar

Watchers

 avatar

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.