Polymake Template Library (PTL): polymake Namespace Reference
Polymake Template Library (PTL)  4.2
polymake Namespace Reference

namespace to be used for client code More...

Classes

struct  AnyString
 
struct  is_derived_from_instance_of
 
struct  is_instance_of
 Check whether a type is an instance of a given class template. More...
 
struct  is_lossless_convertible_impl2
 
struct  mbind1st
 Reduce a binary meta-function to a unary one by fixing the first argument to a given value. More...
 
struct  mbind2nd
 Reduce a binary meta-function to a unary one by fixing the second argument to a given value. More...
 
struct  mbind_const
 Wrappers for arbitrary meta-functions. More...
 
struct  meta_function
 
struct  mget_template_parameter
 
struct  mlist
 container for arbitrary many types More...
 
struct  mlist_and_nonempty
 like mlist_and, but delivers false_type on empty input More...
 
struct  mlist_append_if
 
struct  mlist_at
 
struct  mlist_concat
 
struct  mlist_difference
 
struct  mlist_even_subset
 Extract elements at even positions. More...
 
struct  mlist_filter_binary
 
struct  mlist_filter_unary
 
struct  mlist_find_first
 
struct  mlist_find_if
 
struct  mlist_fold
 
struct  mlist_fold_transform
 
struct  mlist_head
 
struct  mlist_insert
 
struct  mlist_insert_unique
 
struct  mlist_intersection
 
struct  mlist_is_tail_of
 Check whether one list coincides with the tail of another list. More...
 
struct  mlist_length
 compute the length of a meta-list More...
 
struct  mlist_match_all
 
struct  mlist_match_impl
 
struct  mlist_odd_subset
 Extract elements at odd positions. More...
 
struct  mlist_prepend_if
 
struct  mlist_replace_at
 
struct  mlist_reverse
 Reverse the elements in a meta-list. More...
 
struct  mlist_slice
 
struct  mlist_sort
 Sort a meta-list according to the given element comparator. More...
 
struct  mlist_tail
 
struct  mlist_transform_binary
 Apply a binary meta-function pairwise to the elements of two meta-lists. More...
 
struct  mlist_transform_unary
 Apply a unary meta-function to the elements of a meta-list. More...
 
struct  mlist_unwrap
 extract the single element from a meta-list, preserve the list if it contains more than one element More...
 
struct  mlist_wrap
 construct a meta-list with given elements unless it's already a meta-list itself More...
 
struct  mnegate_binary
 Negate the result of a binary boolean meta-function. More...
 
struct  mnegate_unary
 Negate the result of a unary boolean meta-function. More...
 
struct  mprefer1st
 Operation on a pair of types: selects the first one unless it is void. More...
 
struct  mprefer2nd
 Operation on a pair of types: selects the second one unless it is void. More...
 
struct  mproject1st
 Operation on a pair of types: selects the first one. More...
 
struct  mproject2nd
 Operation on a pair of types: selects the second one. More...
 
struct  mrepeat
 
struct  mreplace_template_parameter
 
struct  mreplicate
 Construct a meta-list consisting of N copies of the same element. More...
 
struct  msafely_eval
 
struct  msafely_eval_boolean
 
struct  mselect
 
struct  mswap_args
 Swap arguments passed to a binary meta-function. More...
 
struct  mtagged_list_add_default
 Append elements to a tagged meta-list unless another elements with identical tags are already there. More...
 
struct  mtagged_list_concat
 
struct  mtagged_list_extract
 
struct  mtagged_list_modify
 
struct  mtagged_list_remove
 
struct  mtagged_list_replace
 
struct  munwrap_index_sequence
 Convert a meta-list of encapsulated integer constants into an index sequence. More...
 
struct  reverse_index_sequence
 Construct a falling index sequence N-1, N-2, ..., 1, 0. More...
 

Typedefs

template<typename T >
using mvalue_of = std::integral_constant< typename T::value_type, T::value >
 Canonicalized compile-time constant.
 
template<typename Const1 , typename Const2 >
using mis_equal = bool_constant<(Const1::value==Const2::value)>
 Operations on compile-time constants.
 
template<typename T , int Pos>
using mlist_at_rev = mlist_at< T, mlist_length< T >::value-Pos-1 >
 counting position backwards
 
template<typename List , int Start, int End, typename... Insert>
using mlist_replace_between = mlist_concat< typename mlist_slice< List, 0, Start >::type, Insert..., typename mlist_slice< List, End >::type >
 
template<typename List , int Pos>
using mlist_remove_at = mlist_replace_at< List, Pos >
 
template<typename List , typename Value >
using mlist_find = mlist_find_if< List, std::is_same, Value >
 Find the first occurrence of an element in a meta-list.
 
template<typename List , typename Value , template< typename, typename > class Compare = std::is_same>
using mlist_contains = bool_constant< mlist_find_if< List, Compare, Value >::value >
 Tell whether an element is contained in a meta-list.
 
template<typename List , typename Element , typename NewElement , template< typename, typename > class Compare = std::is_same>
using mlist_replace = mlist_replace_at< List, mlist_find_if< List, Compare, Element >::pos, NewElement >
 
template<typename List , typename Element , template< typename, typename > class Compare = std::is_same>
using mlist_remove = mlist_remove_at< List, mlist_find_if< List, Compare, Element >::pos >
 
template<typename T , typename... Expected>
using is_among = mlist_contains< typename mlist_wrap< Expected... >::type, T >
 
template<typename List1 , typename List2 , template< typename, typename > class Compare = std::is_same>
using mlists_are_equivalent = bool_constant<(mlist_is_empty< typename mlist_match< List1, List2, Compare >::complement >::value &&mlist_is_empty< typename mlist_match< List1, List2, Compare >::complement2 >::value)>
 Shortcut wrappers around mlist_match. More...
 
template<typename List1 , typename List2 , template< typename, typename > class Compare = std::is_same>
using mlists_are_intersecting = bool_not< mlist_is_empty< typename mlist_match< List1, List2, Compare >::type > >
 Tell whether meta-lists have any elements in common.
 
template<typename List1 , typename List2 , template< typename, typename > class Compare = std::is_same>
using mlists_are_disjoint = mlist_is_empty< typename mlist_match< List1, List2, Compare >::type >
 Tell whether meta-lists do not have any elements in common.
 
template<typename List1 , typename List2 , template< typename, typename > class Compare = std::is_same>
using mlist_is_included = mlist_is_empty< typename mlist_match< List1, List2, Compare >::complement >
 Tell whether one meta-list is completely contained in another one regardless the element order.
 
template<typename... T>
using mlist_and = bool_not< mlist_find_first< typename mlist_concat< T... >::type, bool_not > >
 Compute the boolean conjunction (AND) of one or more constants.
 
template<typename... T>
using mlist_or = mlist_find_first< typename mlist_concat< T... >::type, mvalue_of >
 Compute the boolean disjunction (OR) of one or more constants.
 
template<typename List , typename Depth = int_constant<-1>>
using mlist_flatten = mlist_flatten_impl< typename mlist_wrap< List >::type, Depth::value >
 
template<typename List , template< typename, typename > class Compare = std::is_same>
using mlist_remove_duplicates = mlist_wrap< typename mlist_fold< List, mlist_remove_duplicates_impl< Compare >::template func >::type >
 Remove duplicate elements from a meta-list.
 
template<typename List1 , typename List2 >
using mlist_union = mlist_fold< List1, mlist_remove_duplicates_impl< std::is_same >::template func, List2 >
 
template<typename List1 , typename List2 >
using mlist_symdifference = mlist_concat< typename mlist_match< List1, List2 >::complement, typename mlist_match< List1, List2 >::complement2 >
 
template<typename List , typename Tags >
using mtagged_list_intersect = mlist_match_all< List, Tags, has_same_tag >
 
template<typename Derived , typename Base >
using is_derived_from = std::is_base_of< Base, Derived >
 convenience shortcut
 
template<typename Derived , typename... Bases>
using is_derived_from_any = mlist_find_if< typename mlist_wrap< Bases... >::type, std::is_base_of, Derived >
 
template<typename... T>
using least_derived_class = mlist_fold< typename mlist_wrap< T... >::type, least_derived_helper >
 
template<typename... T>
using most_derived_class = mlist_fold< typename mlist_wrap< T... >::type, most_derived_helper >
 
template<typename Target , typename Source >
using is_direct_constructible = std::is_constructible< Target, Source >
 alias wrapping variadic std::is_constructible into a binary meta-function
 
template<typename Source , typename... Targets>
using can_construct_any = mlist_find_if< typename mlist_wrap< Targets... >::type, is_direct_constructible, Source >
 
template<typename Source , typename Target >
using can_assign_to = std::is_assignable< std::add_lvalue_reference_t< Target >, Source >
 convenience shortcut swapping the order of arguments
 
template<typename T >
using is_comparable = are_comparable< T, T >
 Check whether the "equal" and "not equal" operators are defined for a given type.
 
template<typename T >
using is_less_greater_comparable = are_less_greater_comparable< T, T >
 Check whether the "less than" and "greater than" operators are defined for a given type.
 

Functions

template<typename T >
private_mutable_t< T > ensure_private_mutable (T &&x)
 enforce a local copy of an object unless it's already a prvalue
 
template<typename Source , typename Member , typename Owner >
auto reverse_cast (Source *data_member, Member Owner::*member_ptr)
 Calculate a pointer to an enclosing class object from a given pointer to a data member.
 
template<typename Member , typename Source , typename Owner , size_t size>
auto reverse_cast (Source *data_member, Int i, Member(Owner::*member_ptr)[size])
 Calculate a pointer to an enclosing class object from a given pointer to an element in a data member array.
 
std::string legible_typename (const std::type_info &ti)
 
template<typename T >
std::string legible_typename ()
 convenience wrapper
 

Detailed Description

namespace to be used for client code

Typedef Documentation

◆ can_construct_any

template<typename Source , typename... Targets>
using polymake::can_construct_any = typedef mlist_find_if<typename mlist_wrap<Targets...>::type, is_direct_constructible, Source>

Tell whether the given type can be used as a constructor argument for any of the given targets.

Returns
match first target type from the list or void

◆ is_among

template<typename T , typename... Expected>
using polymake::is_among = typedef mlist_contains<typename mlist_wrap<Expected...>::type, T>

Tell whether the first type occurs among the rest. Convenience wrapper for SFINAE-overloaded functions.

◆ is_derived_from_any

template<typename Derived , typename... Bases>
using polymake::is_derived_from_any = typedef mlist_find_if<typename mlist_wrap<Bases...>::type, std::is_base_of, Derived>

Tell whether the given type is derived from any of the given base types

Returns
match first base type from the list or void

◆ least_derived_class

template<typename... T>
using polymake::least_derived_class = typedef mlist_fold<typename mlist_wrap<T...>::type, least_derived_helper>

Find a class among all given types all others are derived from. If there is none, the result is void. This differs from std::common_type in two aspects:

  • default class constructors may be protected or even deleted; clang can only report common types for classes with public default constructors
  • this function does not report the common base class if that does not occur among the arguments

◆ mlist_flatten

template<typename List , typename Depth = int_constant<-1>>
using polymake::mlist_flatten = typedef mlist_flatten_impl<typename mlist_wrap<List>::type, Depth::value>

Create a flattened list from a list of (possibly) nested lists. Empty elements are elided. TDepth::value sets the descending depth limit: 0 means no conversion at all; -1 means unlimited descending

◆ mlist_remove

template<typename List , typename Element , template< typename, typename > class Compare = std::is_same>
using polymake::mlist_remove = typedef mlist_remove_at<List, mlist_find_if<List, Compare, Element>::pos>

Remove an element from a meta-list. If it does not occur in the list, the result equals the input list.

◆ mlist_remove_at

template<typename List , int Pos>
using polymake::mlist_remove_at = typedef mlist_replace_at<List, Pos>

Remove an element from a meta-list at the given position. When Pos==-1, nothing is changed.

◆ mlist_replace

template<typename List , typename Element , typename NewElement , template< typename, typename > class Compare = std::is_same>
using polymake::mlist_replace = typedef mlist_replace_at<List, mlist_find_if<List, Compare, Element>::pos, NewElement>

Replace an element in a meta-list If it does not occur in the list, the result equals the input list.

◆ mlist_replace_between

template<typename List , int Start, int End, typename... Insert>
using polymake::mlist_replace_between = typedef mlist_concat<typename mlist_slice<List, 0, Start>::type, Insert..., typename mlist_slice<List, End>::type>

Replace a slice in a meta-list with new elements. The slice is specified like in mlist_slice. If Start==End, no elements are removed; the new elements are inserted at the given position.

◆ mlist_symdifference

template<typename List1 , typename List2 >
using polymake::mlist_symdifference = typedef mlist_concat<typename mlist_match<List1, List2>::complement, typename mlist_match<List1, List2>::complement2>

Compute a symmetric difference of two meta-lists. Lists are supposed to be free from duplicates.

◆ mlist_union

template<typename List1 , typename List2 >
using polymake::mlist_union = typedef mlist_fold<List1, mlist_remove_duplicates_impl<std::is_same>::template func, List2>

Compute a union of two meta-lists. Lists are supposed to be free from duplicates.

◆ mlists_are_equivalent

template<typename List1 , typename List2 , template< typename, typename > class Compare = std::is_same>
using polymake::mlists_are_equivalent = typedef bool_constant<(mlist_is_empty<typename mlist_match<List1, List2, Compare>::complement>::value && mlist_is_empty<typename mlist_match<List1, List2, Compare>::complement2>::value)>

Shortcut wrappers around mlist_match.

Tell whether meta-lists are equal regardless the element order

◆ most_derived_class

template<typename... T>
using polymake::most_derived_class = typedef mlist_fold<typename mlist_wrap<T...>::type, most_derived_helper>

Find a class derived from all others in the list. If there is none, the result is void.

◆ mtagged_list_intersect

template<typename List , typename Tags >
using polymake::mtagged_list_intersect = typedef mlist_match_all<List, Tags, has_same_tag>

Find all elements with desired tags in a tagged meta-list. The desired tags can be specified with arbitrary contents, e.g. with void.

Function Documentation

◆ legible_typename()

std::string polymake::legible_typename ( const std::type_info &  ti)

Produce a type name as a valid C++ source code type id. Namespace prefixes polymake:: are removed for better legibility.