Skip to content
Snippets Groups Projects
  1. Nov 13, 2017
    • Jö Fahlke's avatar
      [autoCopy()] Unproxying and evaluation helper for `auto`. · dca8f96b
      Jö Fahlke authored
      This introduces a helper function that enables `auto` type deduction even in
      the presence of proxies and pre-C++11 libraries with a tendency to capture
      references to temporaries.
      
      Note: the motivating examples below make use of specializations of
            `autoCopy()` that will be introduced in later commits.
      
      Example 1: deducing the element type of a vector when proxies are a
      possibility:
      ```c++
      template<class Vector>
      auto pop_and_clear(Vector &v)
      {
        auto head = autoCopy(v[0]);
        v.clear();
        return head;
      }
      ```
      Without `autoCopy()` this would be undefined behaviour if `Vector` happens to
      be `std::vector<bool>`.
      
      Example 2: a custom number type with lazy evaluation:
      ```c++
      template<class MaybeCustomType>
      auto f(MaybeCustomType v)
      {
        return 2 * v - 1;
      }
      ```
      This fails for the custom number type from the automatic differentiation
      library Adept, because Adept constructs an expression object that holds
      references to its subexpressions and is evaluated only when it is assigned to
      a number object later.  Due to the use of `auto` this expression object is
      passed out of the function, but the temporary object for the subexpression
      `2*v` is destroyed when the function returns.  Wrapping the expression in the
      `return` statement with `autoCopy()` ensures that the evaluation happens while
      the reference to the subexpression is still valid, and has no ill effect when
      fundamental types instead of Adept's custom types are used.
      
      See merge request !345
      dca8f96b
  2. Nov 10, 2017
  3. Nov 08, 2017
  4. Nov 06, 2017
    • Jö Fahlke's avatar
      Merge branch 'fix/deal-with-dune-array' into 'master' · 84940d4d
      Jö Fahlke authored
      Deal with dune/common/array.hh
      
      Closes #13
      
      See merge request !359
      84940d4d
    • Steffen Müthing's avatar
      Merge branch 'bugfix/make-add-test-work-for-mpich' into 'master' · b2efb967
      Steffen Müthing authored
      [bugfix] make `dune_add_test` play nicely with MPICH
      
      Closes #24
      
      See merge request !363
      b2efb967
    • Martin Nolte's avatar
      [bugfix] quote name of executable in `dune_add_test` · 87afe150
      Martin Nolte authored
      Thanks to @smuething for the hint.
      
      Note: This patch changes the semantics of the command. Up to now, the command
            was allowed to contain arguments (unless it was a target). With this patch,
            the arguments must be passed separately.
      87afe150
    • Ansgar Burchardt's avatar
      Merge branch 'fix/minimal_debug_level_vverb' into 'master' · b914b997
      Ansgar Burchardt authored
      [cmake] Fix vverb not recognized as MINIMAL_DEBUG_LEVEL
      
      See merge request !356
      b914b997
    • Jö Fahlke's avatar
      [array.hh] Deprecate Dune::array and helpers. · cc7f9462
      Jö Fahlke authored
      This deprecates the header `<dune/common/array.hh>` and all of its members.
      - `Dune::array`: use `std::array` instead.
      - `Dune::make_array()`: use `Dune::Std::make_array()` instead.
      - `Dune::fill_array()`: use `Dune::filledArray()` instead.
      
      Note that deprecation warnings for `array` and `make_array` could not be
      implemented, since those were implemented by using declarations and it seems
      to be impossible to deprecate those.  Users should still get a note though
      since the entire header is deprecated.
      
      For `fill_array()` there was no replacement, so this commit introduces
      `filledArray()` with a slightly improved calling syntax, a better name, and
      (in C++17) support for `constexpr` arrays.  To make it possible to deprecate
      `array.hh`, that replacement is in its own header `filledarray.hh`.
      
      This commit also introduces two unit tests:
      - `filledarraytest.cc` to test `filledArray()`, and
      - `arraydeprecationtest.cc` to make sure the deprecation syntax is supported
        for all tested compilers.  (It also has a feature to check that deprecation
        warnings are really displayed, but that is disabled for regular unit testing
        since the logs have to be checked manually for the warnings.)
      cc7f9462
  5. Nov 05, 2017
  6. Nov 03, 2017
  7. Nov 02, 2017
  8. Nov 01, 2017
  9. Oct 31, 2017
  10. Oct 30, 2017
  11. Oct 27, 2017
    • Ansgar Burchardt's avatar
      Merge branch 'fix-cmake' into 'master' · f23b06de
      Ansgar Burchardt authored
      cmake: fix regex for hidden files
      
      See merge request !330
      f23b06de
    • Jö Fahlke's avatar
      22449a85
    • Jö Fahlke's avatar
      [autoCopy()] Unit test. · 09155556
      Jö Fahlke authored
      09155556
    • Jö Fahlke's avatar
      [autoCopy()] Unproxying and evaluation helper for `auto`. · 62ec1946
      Jö Fahlke authored
      This introduces a helper function that enables `auto` type deduction even in
      the presence of proxies and pre-C++11 libraries with a tendency to capture
      references to temporaries.
      
      Note: the motivating examples below make use of specializations of
            `autoCopy()` that will be introduced in later commits.
      
      Example 1: deducing the element type of a vector when proxies are a
      possibility:
      ```c++
      template<class Vector>
      auto pop_and_clear(Vector &v)
      {
        auto head = autoCopy(v[0]);
        v.clear();
        return head;
      }
      ```
      Without `autoCopy()` this would be undefined behaviour if `Vector` happens to
      be `std::vector<bool>`.
      
      Example 2: a custom number type with lazy evaluation:
      ```c++
      template<class MaybeCustomType>
      auto f(MaybeCustomType v)
      {
        return 2 * v - 1;
      }
      ```
      This fails for the custom number type from the automatic differentiation
      library Adept, because Adept constructs an expression object that holds
      references to its subexpressions and is evaluated only when it is assigned to
      a number object later.  Due to the use of `auto` this expression object is
      passed out of the function, but the temporary object for the subexpression
      `2*v` is destroyed when the function returns.  Wrapping the expression in the
      `return` statement with `autoCopy()` ensures that the evaluation happens while
      the reference to the subexpression is still valid, and has no ill effect when
      fundamental types instead of Adept's custom types are used.
      62ec1946
  12. Oct 26, 2017
  13. Oct 24, 2017
Loading