Program Listing for File SetOperations.h

↰ Return to documentation for file (ADS/set/SetOperations.h)

/*--------------------------------------------------------------------------*/
/*-------------------------- File SetOperations.h --------------------------*/
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
/*----------------------------- DEFINITIONS --------------------------------*/
/*--------------------------------------------------------------------------*/

#ifndef __ADS_SetOperations
 #define __ADS_SetOperations
                      /* self-identification: #endif constant */

/*--------------------------------------------------------------------------*/
/*------------------------------ INCLUDES ----------------------------------*/
/*--------------------------------------------------------------------------*/

#include "ADS/ADT.h"
#include "ADS/Contract.h"

#include <algorithm>
#include <concepts>
#include <cstddef>
#include <functional>
#include <optional>
#include <stdexcept>
#include <utility>
#include <vector>

/*--------------------------------------------------------------------------*/
/*--------------------------- NAMESPACE ------------------------------------*/
/*--------------------------------------------------------------------------*/

namespace ADS {

/*--------------------------------------------------------------------------*/
/*--------------------------- GENERIC OPERATIONS ---------------------------*/
/*--------------------------------------------------------------------------*/

template< class S >
concept IterableSet = Set< S > && std::copy_constructible< S > &&
 requires( const S s ) {
  s.forEach( []( const typename S::Item & ) {} );
  };

template< IterableSet S >
S setUnion( const S & A , const S & B );

template< IterableSet S >
S setIntersection( const S & A , const S & B );

template< IterableSet S >
S setDifference( const S & A , const S & B );

template< IterableSet S >
S setSymmetricDifference( const S & A , const S & B );

namespace detail {

template< class C , class A , class B >
bool isSetOperation( const C & c , const A & a , const B & b , char op );

}  // end( namespace detail )

}  // end( namespace ADS )

/*--------------------------------------------------------------------------*/
/*-------------------------- IMPLEMENTATION --------------------------------*/
/*--------------------------------------------------------------------------*/

#include "ADS/set/impl/SetOperations.tpp"

/*--------------------------------------------------------------------------*/

#endif  /* SetOperations.h included */

/*--------------------------------------------------------------------------*/
/*------------------------ End File SetOperations.h ------------------------*/
/*--------------------------------------------------------------------------*/