"Fossies" - the Fresh Open Source Software Archive

Member "dune-typetree-2.8.0/test/testhybridtreepath.cc" (31 Aug 2021, 767 Bytes) of package /linux/misc/dune/dune-typetree-2.8.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "testhybridtreepath.cc": 2.8.0_vs_2.9.0.

    1 #include "config.h"
    2 
    3 #include <iostream>
    4 #include <type_traits>
    5 #include <cassert>
    6 
    7 #include <dune/typetree/typetree.hh>
    8 
    9 int main(int argc, char** argv)
   10 {
   11 
   12   using namespace Dune::Indices;
   13 
   14   {
   15 
   16     constexpr auto path = Dune::TypeTree::hybridTreePath(_1,3,_2,5);
   17 
   18     static_assert(std::is_same<std::decay_t<decltype(path.element(_0))>,std::decay_t<decltype(_1)>>{},"wrong entry value");
   19     static_assert(path.element(_0) == 1,"wrong entry value");
   20 
   21     static_assert(std::is_same<std::decay_t<decltype(path[_2])>,std::decay_t<decltype(_2)>>{},"wrong entry value");
   22     static_assert(path[_0] == 1,"wrong entry value");
   23 
   24     assert(path.element(_0) == 1);
   25     assert(path.element(3) == 5);
   26 
   27     assert(path[_0] == 1);
   28     assert(path[3] == 5);
   29 
   30   }
   31 
   32   return 0;
   33 }