Skip to main content
replaced http://scicomp.stackexchange.com/ with https://scicomp.stackexchange.com/
Source Link

Two examples of libraries that use modern C++ constructs:

  • Both the eigen and armadillo libraries (linear algebra) use several modern C++ constructs. For instance, they use both expression templates to simplify arithmetic expressions and can sometimes eliminate some temporaries:

http://eigen.tuxfamily.org

http://arma.sourceforge.net/

http://hpac.rwth-aachen.de/teaching/sem-accg-14/Armadillo.pdf (presentation on expression templates in Armadillo)

  • The CGAL library (computational geometry) uses many modern C++ features (it heavily uses templates and specializations):

http://www.cgal.org

Note:

modern C++ constructs are very elegant and can be very fun to use. It is both a strong point and a weakness: when using them, it is so tempting to add several layers of templates / specializations / lambdas that in the end you sometimes get more "administration" than effective code in the program (in other words, your program "talks" more about the problem than describing the solution). Finding the right balance is very subtle. Conclusion: one needs to track the evolution of the "signal/noise" ratio in the code by measuring:

  • how many lines of code in the program ?
  • how many classes/templates ?
  • running time ?
  • memory consumption ?

Everything that increases the first two ones may be considered as a cost (because it may make the program harder to understand and to maintain), everything that decreases the last two ones is a gain.

For instance, introducing an abstraction (a virtual class or a template) can factor code and make the program simpler (gain), but if it is never derivated / instanced once only, then it introduces a cost for no associated gain (again it is subtle because the gain may come later in the future evolution of the program, therefore there is no "golden rule").

Programmer's comfort is also an important factor to be taken into account in the cost/gain balance: with too many templates, compilation time may increase significantly, and error messages become difficult to parse.

See also

To what extent is generic and meta-programming using C++ templates useful in computational science?To what extent is generic and meta-programming using C++ templates useful in computational science?

Two examples of libraries that use modern C++ constructs:

  • Both the eigen and armadillo libraries (linear algebra) use several modern C++ constructs. For instance, they use both expression templates to simplify arithmetic expressions and can sometimes eliminate some temporaries:

http://eigen.tuxfamily.org

http://arma.sourceforge.net/

http://hpac.rwth-aachen.de/teaching/sem-accg-14/Armadillo.pdf (presentation on expression templates in Armadillo)

  • The CGAL library (computational geometry) uses many modern C++ features (it heavily uses templates and specializations):

http://www.cgal.org

Note:

modern C++ constructs are very elegant and can be very fun to use. It is both a strong point and a weakness: when using them, it is so tempting to add several layers of templates / specializations / lambdas that in the end you sometimes get more "administration" than effective code in the program (in other words, your program "talks" more about the problem than describing the solution). Finding the right balance is very subtle. Conclusion: one needs to track the evolution of the "signal/noise" ratio in the code by measuring:

  • how many lines of code in the program ?
  • how many classes/templates ?
  • running time ?
  • memory consumption ?

Everything that increases the first two ones may be considered as a cost (because it may make the program harder to understand and to maintain), everything that decreases the last two ones is a gain.

For instance, introducing an abstraction (a virtual class or a template) can factor code and make the program simpler (gain), but if it is never derivated / instanced once only, then it introduces a cost for no associated gain (again it is subtle because the gain may come later in the future evolution of the program, therefore there is no "golden rule").

Programmer's comfort is also an important factor to be taken into account in the cost/gain balance: with too many templates, compilation time may increase significantly, and error messages become difficult to parse.

See also

To what extent is generic and meta-programming using C++ templates useful in computational science?

Two examples of libraries that use modern C++ constructs:

  • Both the eigen and armadillo libraries (linear algebra) use several modern C++ constructs. For instance, they use both expression templates to simplify arithmetic expressions and can sometimes eliminate some temporaries:

http://eigen.tuxfamily.org

http://arma.sourceforge.net/

http://hpac.rwth-aachen.de/teaching/sem-accg-14/Armadillo.pdf (presentation on expression templates in Armadillo)

  • The CGAL library (computational geometry) uses many modern C++ features (it heavily uses templates and specializations):

http://www.cgal.org

Note:

modern C++ constructs are very elegant and can be very fun to use. It is both a strong point and a weakness: when using them, it is so tempting to add several layers of templates / specializations / lambdas that in the end you sometimes get more "administration" than effective code in the program (in other words, your program "talks" more about the problem than describing the solution). Finding the right balance is very subtle. Conclusion: one needs to track the evolution of the "signal/noise" ratio in the code by measuring:

  • how many lines of code in the program ?
  • how many classes/templates ?
  • running time ?
  • memory consumption ?

Everything that increases the first two ones may be considered as a cost (because it may make the program harder to understand and to maintain), everything that decreases the last two ones is a gain.

For instance, introducing an abstraction (a virtual class or a template) can factor code and make the program simpler (gain), but if it is never derivated / instanced once only, then it introduces a cost for no associated gain (again it is subtle because the gain may come later in the future evolution of the program, therefore there is no "golden rule").

Programmer's comfort is also an important factor to be taken into account in the cost/gain balance: with too many templates, compilation time may increase significantly, and error messages become difficult to parse.

See also

To what extent is generic and meta-programming using C++ templates useful in computational science?

Mentioned compilation time (as suggested by Kirill)
Source Link
BrunoLevy
  • 2.3k
  • 14
  • 22

Two examples of libraries that use modern C++ constructs:

  • Both the eigen and armadillo libraries (linear algebra) use several modern C++ constructs. For instance, they use both expression templates to simplify arithmetic expressions and can sometimes eliminate some temporaries:

http://eigen.tuxfamily.org

http://arma.sourceforge.net/

http://hpac.rwth-aachen.de/teaching/sem-accg-14/Armadillo.pdf (presentation on expression templates in Armadillo)

  • The CGAL library (computational geometry) uses many modern C++ features (it heavily uses templates and specializations):

http://www.cgal.org

Note:

modern C++ constructs are very elegant and can be very fun to use. It is both a strong point and a weakness: when using them, it is so tempting to add several layers of templates / specializations / lambdas that in the end you sometimes get more "administration" than effective code in the program (in other words, your program "talks" more about the problem than describing the solution). Finding the right balance is very subtle. Conclusion: one needs to track the evolution of the "signal/noise" ratio in the code by measuring:

  • how many lines of code in the program ?
  • how many classes/templates ?
  • running time ?
  • memory consumption ?

Everything that increases the first two ones may be considered as a cost (because it may make the program harder to understand and to maintain), everything that decreases the last two ones is a gain.

For instance, introducing an abstraction (a virtual class or a template) can factor code and make the program simpler (gain), but if it is never derivated / instanced once only, then it introduces a cost for no associated gain (again it is subtle because the gain may come later in the future evolution of the program, therefore there is no "golden rule").

Programmer's comfort is also an important factor to be taken into account in the cost/gain balance: with too many templates, compilation time may increase significantly, and error messages become difficult to parse.

See also

To what extent is generic and meta-programming using C++ templates useful in computational science?

Two examples of libraries that use modern C++ constructs:

  • Both the eigen and armadillo libraries (linear algebra) use several modern C++ constructs. For instance, they use both expression templates to simplify arithmetic expressions and can sometimes eliminate some temporaries:

http://eigen.tuxfamily.org

http://arma.sourceforge.net/

http://hpac.rwth-aachen.de/teaching/sem-accg-14/Armadillo.pdf (presentation on expression templates in Armadillo)

  • The CGAL library (computational geometry) uses many modern C++ features (it heavily uses templates and specializations):

http://www.cgal.org

Note:

modern C++ constructs are very elegant and can be very fun to use. It is both a strong point and a weakness: when using them, it is so tempting to add several layers of templates / specializations / lambdas that in the end you sometimes get more "administration" than effective code in the program (in other words, your program "talks" more about the problem than describing the solution). Finding the right balance is very subtle. Conclusion: one needs to track the evolution of the "signal/noise" ratio in the code by measuring:

  • how many lines of code in the program ?
  • how many classes/templates ?
  • running time ?
  • memory consumption ?

Everything that increases the first two ones may be considered as a cost (because it may make the program harder to understand and to maintain), everything that decreases the last two ones is a gain.

For instance, introducing an abstraction (a virtual class or a template) can factor code and make the program simpler (gain), but if it is never derivated / instanced once only, then it introduces a cost for no associated gain (again it is subtle because the gain may come later in the future evolution of the program, therefore there is no "golden rule").

See also

To what extent is generic and meta-programming using C++ templates useful in computational science?

Two examples of libraries that use modern C++ constructs:

  • Both the eigen and armadillo libraries (linear algebra) use several modern C++ constructs. For instance, they use both expression templates to simplify arithmetic expressions and can sometimes eliminate some temporaries:

http://eigen.tuxfamily.org

http://arma.sourceforge.net/

http://hpac.rwth-aachen.de/teaching/sem-accg-14/Armadillo.pdf (presentation on expression templates in Armadillo)

  • The CGAL library (computational geometry) uses many modern C++ features (it heavily uses templates and specializations):

http://www.cgal.org

Note:

modern C++ constructs are very elegant and can be very fun to use. It is both a strong point and a weakness: when using them, it is so tempting to add several layers of templates / specializations / lambdas that in the end you sometimes get more "administration" than effective code in the program (in other words, your program "talks" more about the problem than describing the solution). Finding the right balance is very subtle. Conclusion: one needs to track the evolution of the "signal/noise" ratio in the code by measuring:

  • how many lines of code in the program ?
  • how many classes/templates ?
  • running time ?
  • memory consumption ?

Everything that increases the first two ones may be considered as a cost (because it may make the program harder to understand and to maintain), everything that decreases the last two ones is a gain.

For instance, introducing an abstraction (a virtual class or a template) can factor code and make the program simpler (gain), but if it is never derivated / instanced once only, then it introduces a cost for no associated gain (again it is subtle because the gain may come later in the future evolution of the program, therefore there is no "golden rule").

Programmer's comfort is also an important factor to be taken into account in the cost/gain balance: with too many templates, compilation time may increase significantly, and error messages become difficult to parse.

See also

To what extent is generic and meta-programming using C++ templates useful in computational science?

Added a reference to a (related) question
Source Link
BrunoLevy
  • 2.3k
  • 14
  • 22

Two examples of libraries that use modern C++ constructs:

  • Both the eigen and armadillo libraries (linear algebra) use several modern C++ constructs. For instance, they use both expression templates to simplify arithmetic expressions and can sometimes eliminate some temporaries:

http://eigen.tuxfamily.org

http://arma.sourceforge.net/

http://hpac.rwth-aachen.de/teaching/sem-accg-14/Armadillo.pdf (presentation on expression templates in Armadillo)

  • The CGAL library (computational geometry) uses many modern C++ features (it heavily uses templates and specializations):

http://www.cgal.org

Note:

modern C++ constructs are very elegant and can be very fun to use. It is both a strong point and a weakness: when using them, it is so tempting to add several layers of templates / specializations / lambdas that in the end you sometimes get more "administration" than effective code in the program (in other words, your program "talks" more about the problem than describing the solution). Finding the right balance is very subtle. Conclusion: one needs to track the evolution of the "signal/noise" ratio in the code by measuring:

  • how many lines of code in the program ?
  • how many classes/templates ?
  • running time ?
  • memory consumption ?

Everything that increases the first two ones may be considered as a cost (because it may make the program harder to understand and to maintain), everything that decreases the last two ones is a gain.

For instance, introducing an abstraction (a virtual class or a template) can factor code and make the program simpler (gain), but if it is never derivated / instanced once only, then it introduces a cost for no associated gain (again it is subtle because the gain may come later in the future evolution of the program, therefore there is no "golden rule").

See also

To what extent is generic and meta-programming using C++ templates useful in computational science?

Two examples of libraries that use modern C++ constructs:

  • Both the eigen and armadillo libraries (linear algebra) use several modern C++ constructs. For instance, they use both expression templates to simplify arithmetic expressions and can sometimes eliminate some temporaries:

http://eigen.tuxfamily.org

http://arma.sourceforge.net/

http://hpac.rwth-aachen.de/teaching/sem-accg-14/Armadillo.pdf (presentation on expression templates in Armadillo)

  • The CGAL library (computational geometry) uses many modern C++ features (it heavily uses templates and specializations):

http://www.cgal.org

Note:

modern C++ constructs are very elegant and can be very fun to use. It is both a strong point and a weakness: when using them, it is so tempting to add several layers of templates / specializations / lambdas that in the end you sometimes get more "administration" than effective code in the program (in other words, your program "talks" more about the problem than describing the solution). Finding the right balance is very subtle. Conclusion: one needs to track the evolution of the "signal/noise" ratio in the code by measuring:

  • how many lines of code in the program ?
  • how many classes/templates ?
  • running time ?
  • memory consumption ?

Everything that increases the first two ones may be considered as a cost (because it may make the program harder to understand and to maintain), everything that decreases the last two ones is a gain.

For instance, introducing an abstraction (a virtual class or a template) can factor code and make the program simpler (gain), but if it is never derivated / instanced once only, then it introduces a cost for no associated gain (again it is subtle because the gain may come later in the future evolution of the program, therefore there is no "golden rule").

Two examples of libraries that use modern C++ constructs:

  • Both the eigen and armadillo libraries (linear algebra) use several modern C++ constructs. For instance, they use both expression templates to simplify arithmetic expressions and can sometimes eliminate some temporaries:

http://eigen.tuxfamily.org

http://arma.sourceforge.net/

http://hpac.rwth-aachen.de/teaching/sem-accg-14/Armadillo.pdf (presentation on expression templates in Armadillo)

  • The CGAL library (computational geometry) uses many modern C++ features (it heavily uses templates and specializations):

http://www.cgal.org

Note:

modern C++ constructs are very elegant and can be very fun to use. It is both a strong point and a weakness: when using them, it is so tempting to add several layers of templates / specializations / lambdas that in the end you sometimes get more "administration" than effective code in the program (in other words, your program "talks" more about the problem than describing the solution). Finding the right balance is very subtle. Conclusion: one needs to track the evolution of the "signal/noise" ratio in the code by measuring:

  • how many lines of code in the program ?
  • how many classes/templates ?
  • running time ?
  • memory consumption ?

Everything that increases the first two ones may be considered as a cost (because it may make the program harder to understand and to maintain), everything that decreases the last two ones is a gain.

For instance, introducing an abstraction (a virtual class or a template) can factor code and make the program simpler (gain), but if it is never derivated / instanced once only, then it introduces a cost for no associated gain (again it is subtle because the gain may come later in the future evolution of the program, therefore there is no "golden rule").

See also

To what extent is generic and meta-programming using C++ templates useful in computational science?

Added a note about the pros/cons of modern C++
Source Link
BrunoLevy
  • 2.3k
  • 14
  • 22
Loading
Added references to Armadillo as suggested
Source Link
BrunoLevy
  • 2.3k
  • 14
  • 22
Loading
Source Link
BrunoLevy
  • 2.3k
  • 14
  • 22
Loading