A. Jiang

Results 78 issues of A. Jiang

如题,机制类似: ```C++ struct Guard { ContainerType* p_container_; ~Guard() { if (p_container_) p_container_->rollback_operation(); } }; ``` 在需要异常回滚的代码之前创建一个 `Guard` 对象: ```C++ Guard guard_{this}; ``` 在操作成功后将防护废弃掉: ```C++ guard_.p_container_ = nullptr; ```

### 逻辑问题 1. 目前空终止符(末尾的 `\0`、 `L\0` 等)的设置是惰性的。这与标准要求不合,并且可能有并发调用 `const` 限定函数导致数据竞争的问题; 2. `capacity()` 的返回值应该是当前分配的存储中能放下的**字符串元素**数,**元素不含末尾的空终止符**(此处与 Jonathan Wakely 确认过)。所以目前实现的值多了 `1` 。 3. 各种插入操作在需要扩容时有可能提前将旧存储释放。而标准是允许插入的范围是就是字符串原先的一部分的,这可能导致问题。 ### 优化问题 1. 复制赋值运算符在 `rhs.size() capacity()` 时不应分配新存储。 2. `operator+` 可以在一些情况不分配新存储。

如题: C++11 拥有 [`forward_list`](https://en.cppreference.com/w/cpp/container/forward_list) 容器。

The term _default member initializer_ is used in later standard revisions (via [P0134R0](https://wg21.link/p0134r0)), and I think it's clearer to use that term instead of "in-class (member) initializer". The anchor (`#Rc-in-class-initializer`)...

Currently, MSVC STL defines two stringization macros in `` for mutually exclusive cases. https://github.com/microsoft/STL/blob/3eac329d1f614ecf138d96c22a3b02f87076bc4a/stl/inc/yvals_core.h#L25-L26 https://github.com/microsoft/STL/blob/3eac329d1f614ecf138d96c22a3b02f87076bc4a/stl/inc/yvals_core.h#L1946-L1947 Would it be better to unconditionally defined one and consistently use it? Also, `_EMIT_STL_MESSAGE` currently...

enhancement

Currently, - [libc++'s `expected`](https://github.com/llvm/llvm-project/blob/d9d20bd81f2f95c9b7510725fb76975e8123a542/libcxx/include/__expected/expected.h) has all deleted overloads specified in the standard, including the inconsistent deleted overload of move assignment operator. - [libstdc++'s `expected`](https://github.com/gcc-mirror/gcc/blob/08c5d26afade74f8493580fb0380abcc7ee9589b/libstdc%2B%2B-v3/include/std/expected) seems to have all but the...

bug

# Describe the bug Currently, MSVC STL's `basic_stringbuf` relies on that the `eback()` pointer points to the beginning of the allocated buffer. https://github.com/microsoft/STL/blob/e077eb66871626d93f50d329e8fa19cefa80aeb3/stl/inc/sstream#L495-L497 Likewise, `basic_syncbuf` requires `pbase()` to behave the...

bug

Towards #183 and #1002. They are internally undeprecated when used as base classes. It seems that when `_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING` is defined, warning should still be suppressed. ~TODO: need to investigate how...

enhancement

The conditions for triviality should be consistent with `optional` and `variant` (see WG21-P0602R4). I've tried to submit an LWG issue for this, but I believe we can conformingly do this...

enhancement

`allocator_shared_for_overwrite` creates allocated non-array objects by default-initialization, so these objects should be destroyed by plain destructor calls, not `Ator::destroy`. Currently the standard wording is unclear on `make_shared_for_overwrite` and `allocate_shared_for_overwrite`, so...

bug