LRDE Tiger Compiler
1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
libastclone.hxx
Go to the documentation of this file.
1
#ifndef ASTCLONE_LIBASTCLONE_HXX
2
# define ASTCLONE_LIBASTCLONE_HXX
3
4
#include <
ast/exp.hh
>
5
#include <
astclone/libastclone.hh
>
6
#include <
astclone/cloner.hh
>
7
8
// Define exported clone functions.
9
namespace
astclone
10
{
11
12
template
<
typename
T>
13
T*
14
clone
(
const
T& tree)
15
{
16
Cloner
clone
;
17
clone
(tree);
18
return
dynamic_cast<
T*
>
(clone.
result_get
());
19
}
20
21
template
<
typename
A>
22
void
23
apply
(applicable<A> f, A*& t)
24
{
25
A* t2 = f(*t);
26
std::swap(t, t2);
27
delete
t2;
28
}
29
30
}
// namespace astclone
31
32
#endif // !ASTCLONE_LIBASTCLONE_HXX
astclone
libastclone.hxx
Generated on Wed Mar 5 2014 15:47:36 for LRDE Tiger Compiler by
1.8.1.2