GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
//1// util.h2// Bistellar3//4// Created by Alexander Thumm on 07.10.11.5// Copyright 2011 -. All rights reserved.6//78#ifndef Bistellar_util_h9#define Bistellar_util_h1011#include <iostream>12#include <vector>13#include <deque>14#include <utility>1516// prints a list in the format [a,b,...,z].17template< class Iterator >18void list_print(std::ostream & os, Iterator first, Iterator last)19{20os << "[";21if (first != last)22os << *first << std::flush;23for (first++; first != last; first++)24os << "," << *first << std::flush;25os << "]";26}2728template< class Container, class Object >29void list_read(std::istream & is, Container & list)30{31is.ignore(1, '[');3233if (is.eof() || is.peek() == ']')34{35is.ignore(1, ']');36}37else38{39is.unget();40do {41is.ignore(1, ',');42Object newObject;43is >> newObject;44list.push_back(newObject);45} while (!is.eof() && is.peek() != ']');4647is.ignore(1, ']');48}49}5051template< class T >52void list_read(std::istream & is, std::vector< T > & list)53{54list_read< std::vector< T >, T >(is, list);55}5657template< class T >58void list_read(std::istream & is, std::deque< T > & list)59{60list_read< std::deque< T >, T >(is, list);61}626364template< class T, class U >65std::ostream & operator<< (std::ostream & os, const std::pair<T,U> & pair )66{67os << pair.first << "," << pair.second;68return os;69}707172// removes all duplivates from the !sorted! array base.73size_t remove_duplicates(void * base, size_t num, size_t size, int (* comparison)(const void *, const void *));74// removes all elements of the !sorted! array base2 from the !sorted! array base.75size_t remove_from_set(void * base, size_t num, const void * base2, size_t num2, size_t size, int (* comparison)(const void *, const void *));7677#endif787980