ENH: Add explicit Matrix(const RawDataArrayType &) constructor#3305
Conversation
|
Passed well on the regular C++ builds (ITK.Linux, ITK.Windows, ITK.macOS), but failed on the Python builds, saying:
At https://open.cdash.org/viewBuildError.php?buildid=7798097 Any clue? Would |
Probably. @thewtex will know, maybe even @PranjalSahu (he had a close encounter with Wrapping recently). |
|
This line of code: Could be rewritten to "old-style": Just wondering if that would fix the SWIG errors... |
|
I don't think old-style |
d9a729c to
d2db189
Compare
|
My most recent force-push removed the typedef ( At https://open.cdash.org/viewBuildError.php?buildid=7799641
So I guess SWIG just does not like a reference to a C-style array as parameter (like the one of the proposed new explicit I still believe the pull request would be useful, but apparently it doesn't "swig". |
d2db189 to
3624d55
Compare
|
@dzenanz Interesting... it looks like my last force-push has worked around the SWIG errors!!! 😄 SWIG appears to like: While SWIG did not like: Personally I would prefer the |
|
SWIG didn't like the non-templated code, but in this case there are multiple ways to template. I don't know that they are any better, but for SWIG research purposes, did you happen to try either of template <typename TMatrix>
explicit Matrix(const TMatrix & matrix)
: m_Matrix(&matrix[0][0])
{
static_assert(std::is_same<TMatrix, T[VRows][VColumns]>::value,
"The type of the matrix should correspond with this itk::Matrix instantiation.");
}
template <typename TElement>
explicit Matrix(const TElement (&elements)[VRows][VColumns])
: m_Matrix(&elements[0][0])
{
static_assert(std::is_same<TElement, T>::value,
"The type of an element should correspond with this itk::Matrix instantiation.");
} |
3624d55 to
35e881a
Compare
No I did not. Thanks for the suggestion @Leengit. |
|
Thanks @N-Dekker. Your code is a-okay, so there is no need to put additional work into these variations. I was asking in case you already had the information. |
Allows constructing an `itk::Matrix` by passing a C-style array of arrays, of the corresponding value type and dimensions. With help from Lee Newberg.
35e881a to
0e7a458
Compare
|
@Leengit Still trying your last suggestion Update: YES it SWIGs!!! |
Allows constructing an
itk::Matrixby passing a C-style array ofarrays, of the corresponding value type and dimensions.