mCRL2
Loading...
Searching...
No Matches
builder_msvc.inc.h
Go to the documentation of this file.
1// Author(s): Wieger Wesselink
2// Copyright: see the accompanying file COPYING or copy at
3// https://github.com/mCRL2org/mCRL2/blob/master/COPYING
4//
5// Distributed under the Boost Software License, Version 1.0.
6// (See accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8//
11/*
12// aterm traversal
13template <typename T>
14T operator()(const T& x,
15 typename std::enable_if< std::is_base_of< atermpp::aterm, T >::value>::type* = 0
16 )
17{
18 core::msg("aterm traversal");
19 throw mcrl2::runtime_error("unknown type encountered in builder function!");
20 return x;
21}
22
23// aterm list traversal
24template <typename T>
25atermpp::term_list<T> operator()(const atermpp::term_list<T>& x)
26{
27 core::msg("aterm list traversal");
28 std::vector<T> result;
29 for (auto i = x.begin(); i != x.end(); ++i)
30 {
31 result.push_back(atermpp::vertical_cast<T>(update_copy(*i)));
32 }
33 return atermpp::term_list<T>(result.begin(), result.end());
34}
35
36// Container traversal
37template <typename T>
38void operator()(T& x,
39 typename std::enable_if< !std::is_base_of< atermpp::aterm, T >::value>::type* = 0,
40 typename atermpp::enable_if_container<T>::type* = 0
41 )
42{
43 core::msg("container traversal");
44 for (auto i = x.begin(); i != x.end(); ++i)
45 {
46 update(*i);
47 }
48}
49
50// aterm set traversal
51template <typename T>
52void operator()(std::set<T>& x)
53{
54 core::msg("aterm set traversal");
55 std::set<T> result;
56 for (auto i = x.begin(); i != x.end(); ++i)
57 {
58 result.insert(update_copy(*i));
59 }
60 using std::swap;
61 swap(x, result);
62}
63*/