-
Notifications
You must be signed in to change notification settings - Fork 32
Updater does not copy vector #1166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -20,6 +20,7 @@ class DictionaryException : public std::exception | |||||
| public: | ||||||
| DictionaryException() = default; | ||||||
| DictionaryException(auto const& k, auto const& v) { (*this)(k, v); } | ||||||
| DictionaryException(auto const& cause) { (*this)("cause", cause); } | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: cat -n src/core/errors.hppRepository: PHAREHUB/PHARE Length of output: 3070 🏁 Script executed: #!/bin/bash
# Search for DictionaryException constructor call sites
rg -n 'DictionaryException\s*\(' --type=cpp --type=c --type=hpp --type=h -A 2Repository: PHAREHUB/PHARE Length of output: 85 🏁 Script executed: #!/bin/bash
# Search for DictionaryException constructor call sites
rg -n 'DictionaryException\s*\(' --type=cpp --type=c --type=h -A 2Repository: PHAREHUB/PHARE Length of output: 402 🏁 Script executed: #!/bin/bash
# Search for instantiation/throw patterns
rg -n 'throw\s+.*DictionaryException|DictionaryException\s*{' --type=cpp --type=c --type=h -B 1 -A 3Repository: PHAREHUB/PHARE Length of output: 227 🏁 Script executed: #!/bin/bash
# Search for throw statements with DictionaryException
rg -n 'throw.*DictionaryException' --type=cpp --type=c --type=h -A 2Repository: PHAREHUB/PHARE Length of output: 1027 🏁 Script executed: #!/bin/bash
# Search for usage of the two-arg constructor pattern
rg -n 'DictionaryException\s*\([^)]*,\s*[^)]*\)' --type=cpp --type=c --type=h -B 1 -A 1Repository: PHAREHUB/PHARE Length of output: 308 🏁 Script executed: #!/bin/bash
# Get more context from the boris.hpp usage
sed -n '155,170p' src/core/numerics/pusher/boris.hppRepository: PHAREHUB/PHARE Length of output: 646 Make the single-argument constructor explicit and type-aligned. Line 23 uses a generic constructor signature ( Suggested change- DictionaryException(auto const& cause) { (*this)("cause", cause); }
+ explicit DictionaryException(std::string const& cause) { (*this)("cause", cause); }📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
|
|
||||||
| using Dict_t = cppdict::Dict<std::string>; | ||||||
|
|
||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add explicit precondition guards in
swap_last_reduce_by_one.If this helper is ever called with an empty array or an out-of-range index,
size() - 1underflows and indexing is UB.🔧 Proposed guard
template<typename Cell> bool swap_last_reduce_by_one(Cell const& oldCell, std::size_t const idx) { + assert(size() > 0); + assert(idx < size()); + bool const idx_is_last = idx == size() - 1; if (!idx_is_last) { cellMap_.swap(oldCell, particles_[size() - 1].iCell, idx, size() - 1); particles_[idx] = particles_[size() - 1];🤖 Prompt for AI Agents