What is the recommended way to align memory in C++11

前端 未结 4 598
难免孤独
难免孤独 2020-12-02 05:50

I am working on a single producer single consumer ring buffer implementation.I have two requirements:

  1. Align a single heap allocated instance of a ring buffer to
4条回答
  •  余生分开走
    2020-12-02 06:22

    The answer to your problem is std::aligned_storage. It can be used top level and for individual members of a class.

提交回复
热议问题