10#ifndef MCRL2_ATERMPP_DETAIL_ATERM_CONTAINER_H
11#define MCRL2_ATERMPP_DETAIL_ATERM_CONTAINER_H
54 inline std::size_t
size()
const
64template<
class T,
typename Type =
void >
72template<
class T,
class U>
93template<
class T,
typename Type >
97 typedef typename std::decay<T>::type
T_type;
106 template <
class... Args>
108 :
m_t(std::forward<Args>(args)...)
111 template <
class... Args>
117 :
m_t(std::forward(other))
122 static_assert(std::is_base_of<aterm_core, T_type>::value);
129 static_assert(std::is_base_of<aterm_core, T_type>::value);
130 m_t = std::forward(other);
152 void mark(std::stack<std::reference_wrapper<detail::_aterm>>& todo)
const
162class reference_aterm < T, typename
std::enable_if<std::is_fundamental<typename std::decay<T>::type>::value>::type >
165 typedef typename std::decay<T>::type
T_type;
178 :
m_t(std::move(other))
189 m_t = std::move(other);
199 operator const T&()
const
204 void mark(std::stack<std::reference_wrapper<detail::_aterm>>& )
const
244 static_assert(std::is_base_of<aterm_core, T>::value,
"Term must be derived from an aterm_core");
245 static_assert(
sizeof(T)==
sizeof(std::size_t),
"Term derived from an aterm_core must not have extra fields");
246 return reinterpret_cast<T&
>(*this);
249 operator const T&()
const
251 static_assert(std::is_base_of<aterm_core, T>::value,
"Term must be derived from an aterm_core");
252 static_assert(
sizeof(T)==
sizeof(std::size_t),
"Term derived from an aterm_core must not have extra fields");
253 return reinterpret_cast<const T&
>(*this);
257 void mark(std::stack<std::reference_wrapper<detail::_aterm>>& todo)
const
267typename std::pair<typename std::conditional<is_reference_aterm<typename T::first_type>::value,
268 typename T::first_type,
269 reference_aterm< typename T::first_type > >::type,
270 typename std::conditional<is_reference_aterm<typename T::second_type>::value,
271 typename T::second_type,
272 reference_aterm< typename T::second_type > >::type >
303 public std::pair<typename std::conditional<is_reference_aterm<typename T::first_type>::value,
304 typename T::first_type,
305 reference_aterm< typename T::first_type > >::type,
306 typename std::conditional<is_reference_aterm<typename T::second_type>::value,
307 typename T::second_type,
308 reference_aterm< typename T::second_type > >::type >
311 typedef std::pair<typename std::conditional<is_reference_aterm<typename T::first_type>::value,
312 typename T::first_type,
314 typename std::conditional<is_reference_aterm<typename T::second_type>::value,
315 typename T::second_type,
340 super::first=other.first;
341 super::second=other.second;
347 super::first=other.first;
348 super::second=other.second;
354 super::first = std::move(other.first);
355 super::second = std::move(other.second);
361 super::first = other.first;
362 super::second = other.second;
370 return reinterpret_cast<std_pair>(*this);
375 return *
reinterpret_cast<std_pair const*
>(
this);
378 void mark(std::stack<std::reference_wrapper<detail::_aterm>>& todo)
const
382 super::first.mark(todo);
391 super::second.mark(todo);
400template<
typename T,
typename Allocator>
437template<
typename Container>
445 for (
const typename Container::value_type& element: container)
459 }, std::placeholders::_1),
460 std::bind([&container]() -> std::size_t {
462 return container.size();
497 return std::hash<T>()(t);
The aterm_core base class that provides protection of the underlying shared terms.
aterm_allocator(aterm_allocator &&)=default
aterm_allocator()=default
T * allocate(size_type n, const void *hint=nullptr)
void deallocate(T *p, size_type n)
aterm_allocator & operator=(aterm_allocator &&)=default
std::ptrdiff_t difference_type
Provides safe storage of unprotected_aterm_core instances in a container by marking them during garba...
std::function< std::size_t()> size_func
std::function< void(term_mark_stack &)> mark_func
void mark(term_mark_stack &todo) const
Ensure that all the terms in the containers.
generic_aterm_container & operator=(const generic_aterm_container &)
generic_aterm_container(const generic_aterm_container &)=delete
generic_aterm_container(generic_aterm_container &&)=delete
generic_aterm_container & operator=(generic_aterm_container &)
aterm_container m_container
generic_aterm_container(const Container &container)
Constructor.
reference_aterm(const std_pair &other)
reference_aterm & operator=(reference_aterm &&other)
std::pair< typename std::conditional< is_reference_aterm< typename T::first_type >::value, typename T::first_type, reference_aterm< typename T::first_type > >::type, typename std::conditional< is_reference_aterm< typename T::second_type >::value, typename T::second_type, reference_aterm< typename T::second_type > >::type > super
reference_aterm()=default
Default constructor.
reference_aterm & operator=(const reference_aterm &other)
reference_aterm(const reference_aterm &other)
const reference_aterm & operator=(std_pair &&other)
const reference_aterm & operator=(const std_pair &other)
void mark(std::stack< std::reference_wrapper< detail::_aterm > > &todo) const
reference_aterm(std_pair &&other)
const reference_aterm & operator=(unprotected_aterm_core &&other) noexcept
reference_aterm(const T &other) noexcept
reference_aterm(unprotected_aterm_core &&other) noexcept
void mark(std::stack< std::reference_wrapper< detail::_aterm > > &todo) const
const reference_aterm & operator=(const unprotected_aterm_core &other) noexcept
reference_aterm() noexcept=default
Default constructor.
std::decay< T >::type T_type
reference_aterm(T_type &&other) noexcept
reference_aterm() noexcept=default
Default constructor.
void mark(std::stack< std::reference_wrapper< detail::_aterm > > &) const
const T & operator=(T &&other) noexcept
const T & operator=(const T &other) noexcept
bool operator==(const reference_aterm &other) const
Base class that should not be used.
std::decay< T >::type T_type
reference_aterm(Args &&... args) noexcept
void mark(std::stack< std::reference_wrapper< detail::_aterm > > &todo) const
reference_aterm(const T_type &other) noexcept
const reference_aterm & operator=(T_type &&other) noexcept
reference_aterm(const Args &... args) noexcept
reference_aterm()=default
reference_aterm(T_type &&other) noexcept
const reference_aterm & operator=(const T_type &other) noexcept
An unprotected term does not change the reference count of the shared term when it is copied or moved...
bool defined() const
Returns true if this term is not equal to the term assigned by the default constructor of aterms,...
Inherit from this class to prevent it from being copyable.
_aterm * address(const unprotected_aterm_core &t)
std::pair< typename std::conditional< is_reference_aterm< typename T::first_type >::value, typename T::first_type, reference_aterm< typename T::first_type > >::type, typename std::conditional< is_reference_aterm< typename T::second_type >::value, typename T::second_type, reference_aterm< typename T::second_type > >::type > reference_aterm_pair_constructor_helper(const T &other)
void mark_term(const _aterm &root, std::stack< std::reference_wrapper< _aterm > > &todo)
Marks a term and recursively all arguments that are not reachable.
The main namespace for the aterm++ library.
void mark_term(const aterm_core &t, term_mark_stack &todo)
std::stack< std::reference_wrapper< detail::_aterm > > term_mark_stack
aterm_allocator< U, typename Allocator::template rebind< U >::other > other
std::size_t operator()(const atermpp::detail::reference_aterm< T > &t) const