Skip to content

Conversation

@tigercosmos
Copy link
Collaborator

move TypeBroadcast outside wrapper

@tigercosmos
Copy link
Collaborator Author

I think this logic, copying array, doesn't need to be inside the wrapper, the wrapper should just "wrap" things?

* POSSIBILITY OF SUCH DAMAGE.
*/

#include <pybind11/pybind11.h>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code using pybind11 should live in the python/ sub-directory. Otherwise, pure C++ code will include the Python.h (like here). Python.h alters a lot of things, requires to be included before everything else, and should not be included for pure C++ code.

namespace modmesh
{

static void TypeBroadCast<T>::check_shape(SimpleArray<T> const & arr_out,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is incorrect to put template implementation in a cpp file: https://stackoverflow.com/questions/115703/storing-c-template-function-definitions-in-a-cpp-file . While forceful instantiation may be a workaround (but I do not like it), you do not do it either.

@tigercosmos tigercosmos changed the title [WIP] refactor wrapper of SimpleArray refactor wrapper of SimpleArray Oct 4, 2022
@tigercosmos
Copy link
Collaborator Author

@yungyuc please take a look, also the failed CI is not my problem I thought.

namespace python
{

template <typename T /* original type */, typename D /* for destination type */>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel we have a better way to implement this using helper code in pybind11, but it's a good step forward to move the code to a distinct file!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you provide some examples about "helper code in pybind11"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's a good step forward to move the code to a distinct file!

ya, now the wrapper looks more clear. :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yungyuc Could you answer the question above, I am curious about it. thanks!

@yungyuc
Copy link
Member

yungyuc commented Oct 4, 2022

@yungyuc please take a look, also the failed CI is not my problem I thought.

It's not from your change, but upgrade of clang-tidy to v15 on the gha hosted runner. I will fix it using #126 . Can you rebase to master once that PR is merged?

@tigercosmos
Copy link
Collaborator Author

It's not from your change, but upgrade of clang-tidy to v15 on the gha hosted runner. I will fix it using #126 . Can you rebase to master once that PR is merged?

I just pull the master, please squash the PR when you merge it.

Copy link
Member

@yungyuc yungyuc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rebase. If you want to squash you can do it as you rebase. For this simple refactor it does not make sense to have pull from master.

@tigercosmos
Copy link
Collaborator Author

I've rebased it.

@yungyuc yungyuc added the refactor Change code without changing tests label Oct 5, 2022
@yungyuc yungyuc merged commit b13d1ff into solvcon:master Oct 5, 2022
@yungyuc
Copy link
Member

yungyuc commented Oct 5, 2022

LGTM. Thanks.

@tigercosmos tigercosmos deleted the a1 branch October 6, 2022 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Change code without changing tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants