View Issue Details

IDProjectCategoryView StatusLast Update
0003377OpenFOAMPatchpublic2019-10-31 11:30
Reporterhandrake0724Assigned Tohenry 
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionno change required 
Product Versiondev 
Fixed in Version 
Summary0003377: autoPtr::New method
Descriptionin OpenFOAM-plus, it provide New static method in autoPtr and tmp container.
when I have to use the following statement
    autoPtr<regExp>(new regExp(iter().keyword()))

instead autoPtr::New method make it simple and less verbose as follows:
    autoPtr::New<regExp>(iter().keyword())

New method is implemented with parameter pack in C++11 spec so it is possible to implement it in OpenFOAM-dev.

is there any reason not providing it?
TagsNo tags attached.

Activities

henry

2019-10-30 15:04

manager   ~0010851

There is no particular reason for not providing it nor a clear reason to provide it, the benefit seems rather small. If you wanted to implement it and provide it for consideration we can do that or if you would like to fund us to work on it we can.

handrake0724

2019-10-31 02:06

reporter   ~0010853

In the philosophy of OpenFOAM platform as I understand, it prevents users from directly using pointers and calling new keyword by wrapping it with autoPtr, or tmp.
in that sense, those wrappers can fill the gap by providing New method with the help of c++ 11 spec such that
   - avoid direct use of new keyword
   - eliminate duplicates as autoPtr<regExp>(new regExp(iter().keyword()))
   - improve readability a little

It is just a little sugar and I agree with you in that the benefit may be small.

patch is attached which is excerpted from OpenFOAM-plus implementation.

henry

2019-10-31 08:28

manager   ~0010854

> patch is attached which is excerpted from OpenFOAM-plus implementation.

ESI choose not to contribute to OpenFOAM see https://openfoam.org/dev/contributors/

While you have signed the contributor agreement and can contribute code that you write it does not give you permission to contribute code written by others; you will need to ask them to sign the contributor agreement and contribute their code directly.

handrake0724

2019-10-31 11:21

reporter   ~0010855

If you think this patch will make dispute since it is taken from OpenFOAM-plus code, it is ok to disregard this patch.

I am not sure if this template code can be implemented in the other way though.

henry

2019-10-31 11:30

manager   ~0010856

You cannot transfer the copyright of code you do not own.

Issue History

Date Modified Username Field Change
2019-10-30 14:51 handrake0724 New Issue
2019-10-30 15:04 henry Note Added: 0010851
2019-10-31 02:06 handrake0724 File Added: patch.diff
2019-10-31 02:06 handrake0724 Note Added: 0010853
2019-10-31 08:28 henry Note Added: 0010854
2019-10-31 08:37 henry File Deleted: patch.diff
2019-10-31 11:21 handrake0724 Note Added: 0010855
2019-10-31 11:30 henry Assigned To => henry
2019-10-31 11:30 henry Status new => closed
2019-10-31 11:30 henry Resolution open => no change required
2019-10-31 11:30 henry Note Added: 0010856