Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#1307 の修正と、機能追加です。
追加される機能
Array(size_type count, const value_type& value, const Allocator& alloc = Allocator{})
Array(size_type size, Arg::generator_<Fty> generator)
Array(size_type size, Arg::indexedGenerator_<Fty> indexedGenerator)
Grid(size_type w, size_type h, const value_type& value)
Grid(Size size, const value_type& value)
Grid(size_type w, size_type h, Arg::generator_<Fty> generator)
Grid(Size size, Arg::generator_<Fty> generator)
Grid(size_type w, size_type h, Arg::indexedGenerator_<Fty> indexedGenerator)
Grid(Size size, Arg::indexedGenerator_<Fty> indexedGenerator)
const value_type&
を引数に取るコンストラクタについて問題提起しましたが、この問題を解決するにあたってArg::generator
やArg::indexedGenerator
を考慮する必要があったので、一緒にArg::generator
やArg::indexedGenerator
を取るコンストラクタでも CTAD が効くようにしましたGrid g(2, 2, Array<int, Allocator<int>>{})
のようなコードが有効になってしまいますGrid(size_type w, size_type h, const Array<value_type>& data)
の引数data
はGrid::allocator_type
にかかわらずデフォルトのアロケータを使用するArray
であり、Array<int, Allocator<int>>
などの値は渡せません実装
Array.hpp
,Grid.hpp
に推論補助を追加しましたArray(typename Array<Type, Allocator>::size_type, const Type&, const Allocator& = Allocator{}) -> Array<Type, Allocator>
には以下のような問題があったため、std::is_same_v<typename Allocator::value_type, Type>
でこの推論補助を制約していますArray(typename Array<Type, Allocator>::size_type, const Type&, const Allocator& = Allocator{}) -> Array<Type, Allocator>
および対応するGrid
の推論補助には以下のような問題があったため、not detail::IsNamedParameter_v<Type>
でこれらの推論補助を制約していますdetail::IsNamedParameter_v
を定義し、面倒だったのでArg::generator
,Arg::indexedGenerator
だけでなくすべてのNamedParameter
を弾いていますdetail::IsNamedParameter_v
の定義は少し変なところに置いており、適切ではないかもしれませんテストコード