图
0.1
数据结构_第13章
|
程序设计题第3题:用operator+,*,/实现存储在数组中的集合的并, 交, 差 More...
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <iostream>
#include <vector>
Go to the source code of this file.
Functions | |
template<class T > | |
std::vector< T > | operator+ (const std::vector< T > &vec1, const std::vector< T > &vec2) |
返回两个非降序vector集合的并集vector More... | |
template<class T > | |
std::vector< T > | operator* (const std::vector< T > &vec1, const std::vector< T > &vec2) |
返回两个非降序vector集合的交集vector More... | |
template<class T > | |
std::vector< T > | operator- (const std::vector< T > &vec1, const std::vector< T > &vec2) |
返回两个非降序vector集合的差集vector More... | |
int | main (int argc, char const *argv[]) |
测试程序 More... | |
程序设计题第3题:用operator+,*,/实现存储在数组中的集合的并, 交, 差
See the file LICENSE in the top directory of this distribution for more information.
Definition in file ch8_3.cc.
int main | ( | int | argc, |
char const * | argv[] | ||
) |
std::vector< T > operator* | ( | const std::vector< T > & | vec1, |
const std::vector< T > & | vec2 | ||
) |
返回两个非降序vector集合的交集vector
T | 元素的类型 |
vec1 | 集合1 |
vec2 | 集合2 |
Input iterators to the initial and final positions of the first sorted sequence.
The range used is [first1,last1), which contains all the elements between first1 and last1, including the element pointed by first1 but not the element pointed by last1.
Input iterators to the initial and final positions of the second sorted sequence.
The range used is [first2,last2).
Output iterator to the initial position of the range where the resulting sequence is stored.
The pointed type shall support being assigned the value of an element from the other ranges.
std::vector< T > operator+ | ( | const std::vector< T > & | vec1, |
const std::vector< T > & | vec2 | ||
) |
返回两个非降序vector集合的并集vector
T | 元素的类型 |
vec1 | 集合1 |
vec2 | 集合2 |
Input iterators to the initial and final positions of the first sorted sequence.
The range used is [first1,last1), which contains all the elements between first1 and last1, including the element pointed by first1 but not the element pointed by last1.
Input iterators to the initial and final positions of the second sorted sequence.
The range used is [first2,last2).
Output iterator to the initial position of the range where the resulting sequence is stored.
The pointed type shall support being assigned the value of an element from the other ranges.
std::vector< T > operator- | ( | const std::vector< T > & | vec1, |
const std::vector< T > & | vec2 | ||
) |
返回两个非降序vector集合的差集vector
T | 元素的类型 |
vec1 | 集合1 |
vec2 | 集合2 |
Input iterators to the initial and final positions of the first sorted sequence.
The range used is [first1,last1), which contains all the elements between first1 and last1, including the element pointed by first1 but not the element pointed by last1.
Input iterators to the initial and final positions of the second sorted sequence.
The range used is [first2,last2).
Output iterator to the initial position of the range where the resulting sequence is stored.
The pointed type shall support being assigned the value of an element from the other ranges.