Skip to content

Commit 2a371bd

Browse files
committed
Merge branch 'codac2' into codac2_codac4matlab
2 parents 73f98c6 + e876589 commit 2a371bd

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

python/src/codac2_py_matlab.h

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ namespace codac2
5757
return x;
5858
}
5959

60-
inline std::vector<Index> convert_indices(const std::vector<Index_type>& indices)
61-
{
62-
if constexpr(FOR_MATLAB)
60+
#if FOR_MATLAB
61+
62+
inline std::vector<Index> convert_indices(const std::vector<Index_type>& indices)
6363
{
6464
std::vector<Index> indices_(indices.size());
6565
for(size_t i = 0 ; i < indices.size() ; i++)
@@ -71,8 +71,14 @@ namespace codac2
7171
return indices_;
7272
}
7373

74-
else
74+
#else
75+
76+
// Returning a reference (avoid a copy as in FOR_MATLAB mode)
77+
inline const std::vector<Index>& convert_indices(const std::vector<Index>& indices)
78+
{
7579
return indices;
76-
}
80+
}
81+
82+
#endif
7783
}
7884
}

0 commit comments

Comments
 (0)