Inlet: fix issue created by last PR related to get<>() in container and proxy#1899
Merged
Merged
Conversation
adayton1
approved these changes
Jun 29, 2026
Arlie-Capps
approved these changes
Jun 29, 2026
Member
Author
|
@chapman39 reported this fixed the issue. |
kennyweiss
approved these changes
Jun 30, 2026
Comment on lines
+159
to
200
| /*! | ||
| ******************************************************************************* | ||
| * \brief Returns a user-defined type from the proxy | ||
| * | ||
| * \tparam T The type of the object to retrieve | ||
| * \return The retrieved object | ||
| * \pre The Proxy must refer to a container object | ||
| ******************************************************************************* | ||
| */ | ||
| template <typename T> | ||
| typename std::enable_if<!detail::is_inlet_primitive<T>::value && !detail::is_std_function<T>::value && | ||
| detail::has_ProxyFromInlet_specialization<T>::value, | ||
| T>::type | ||
| get() const | ||
| { | ||
| SLIC_ASSERT_MSG(m_container != nullptr, | ||
| "[Inlet] Tried to read a user-defined type from a Proxy " | ||
| "containing a single field or function"); | ||
| FromInlet<T> from_inlet; | ||
| return from_inlet(*this); | ||
| } | ||
|
|
||
| /*! | ||
| ******************************************************************************* | ||
| * \brief Returns a user-defined type from the proxy | ||
| * | ||
| * \tparam T The type of the object to retrieve | ||
| * \return The retrieved object | ||
| * \pre The Proxy must refer to a container object | ||
| ******************************************************************************* | ||
| */ | ||
| template <typename T> | ||
| typename std::enable_if<!detail::is_inlet_primitive<T>::value && !detail::is_std_function<T>::value, T>::type | ||
| typename std::enable_if<!detail::is_inlet_primitive<T>::value && !detail::is_std_function<T>::value && | ||
| !detail::has_ProxyFromInlet_specialization<T>::value, | ||
| T>::type | ||
| get() const | ||
| { | ||
| SLIC_ASSERT_MSG(m_container != nullptr, | ||
| "[Inlet] Tried to read a user-defined type from a Proxy " | ||
| "containing a single field or function"); | ||
| return m_container->get<T>(); | ||
| } |
Member
There was a problem hiding this comment.
Modernization opportunity (not required for this PR):
This should be easy to express as an if constexpr (and soon, concepts) instead of SFINAE.
Looks like there are several similar opportunities throughout inlet.
Member
Author
There was a problem hiding this comment.
Yes Inlet originally wanted to use concepts due to the complexity of SFINAE but could not. I will do that in a targeted PR eventually.
|
|
||
| TYPED_TEST(inlet_object, variant_struct_by_value) | ||
| { | ||
| std::string testString = "shape = { kind = \"box\"; width = 3.0; height = 4.0 }"; |
Member
There was a problem hiding this comment.
Minor (not required):
This would be somewhat easier to read/maintain as a raw string literal.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Found by @chapman39