Code Monkey home page Code Monkey logo

hstring's Introduction

🎯hstring.h自定义字符串

📣2024.06.15

  1. 重载 + ,实现 "123" + "456" == "123456"
  2. 重载 - ,实现 "123456" - "123" == "456"
  3. 重载 = ,实现 int 转 hstring 字符串和 hstring 的赋值深拷贝
  4. 重载 std::cout ,实现 hstring 的输出显示
  5. 重载 [] ,实现 hstring 的下标读
  6. 改数据,实现 "123456" 修改 23 为 abc,得到 "1abc456"
  7. 查数据,"123456" 查 23 得到 23 的位置 1,使用KMP算法
  8. 支持 int、char*、hstring 构造
  9. 使用内存池作为缓冲,减少内存分配频率

🙈TODO list:

  • ⬜️ 支持 float 类型
  • ⬜️ 支持 std::string 类型
  • ⬜️ 重载 = 的浅拷贝 (必要性?)
  • ⬜️ [] 下标访问的越界处理

🎯mempool.h 内存池

📣2024.06.15

  1. 链表链接链接内存块
  2. 支持内存池大小的动态扩展,默认扩展大小翻倍
  3. 支持内存池块的分配和回收
  4. RAII内存池的创建和销毁

🙈TODO list:

  • ⬜️ 处理 block_size 过小的情况,即block_size < sizeof(char*)
  • ⬜️ 回收内存时,处理不是从mempool分配出去的内存

🙋🙋‍♂遇到的问题

  • 💎 *(char**)ptr 作为链表的next指针, 需要保存分配的总地址空间,以用于释放。 而不是直接释放空闲块的地址
  • 💎 扩展内存池大小时,需要考虑原空间是否还有剩余

🎯logger.h 日志类

📣2024.06.15

  1. 使用c++变参模板重载,实现终端打印函数

hstring's People

Contributors

justhuayu avatar

Stargazers

 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.