File: Default.cpp

package info (click to toggle)
cgal 4.0-5
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 65,068 kB
  • sloc: cpp: 500,870; ansic: 102,544; sh: 321; python: 92; makefile: 75; xml: 2
file content (29 lines) | stat: -rw-r--r-- 579 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <CGAL/Default.h>

// A is a concrete type
struct A {};

// B is the template class which has 2 template parameters
// with default arguments : A and int.
template < typename A1_ = A, typename A2 = int >
struct B
{
    B()
      : a1()
    {}

    // Note that it is also possible to use CGAL::Default
    // instead of A as the default argument for A1_ above.

    // Extract the desired type for A1 :
    typedef typename CGAL::Default::Get<A1_, A>::type  A1;

    A1 a1;
};

int main ()
{
    B<CGAL::Default, double> b;

    A a = b.a1; //  It is really of type A.
}