update
This commit is contained in:
parent
87df2b11c0
commit
a6bf42523b
@ -19,12 +19,12 @@ std::ostream &operator<<(std::ostream &os, const std::array<T,S> &s){
|
||||
os<<"array [ ";
|
||||
if(!s.empty()){
|
||||
auto now_it = s.begin();
|
||||
const auto rbegin = s.rbegin();
|
||||
while(*now_it!=*rbegin){
|
||||
const auto back_1_it = s.end()-1;
|
||||
while(now_it!=back_1_it){
|
||||
os<<*now_it<<", ";
|
||||
++now_it;
|
||||
}
|
||||
os<<*rbegin<<" ]";
|
||||
os<<*back_1_it<<" ]";
|
||||
}else{
|
||||
os<<"}";
|
||||
}
|
||||
@ -36,12 +36,13 @@ std::ostream &operator<<(std::ostream &os, const std::set<T> &s){
|
||||
os<<"set { ";
|
||||
if(!s.empty()){
|
||||
auto now_it = s.begin();
|
||||
const auto rbegin = s.rbegin();
|
||||
while(*now_it!=*rbegin){
|
||||
auto back_1_it = s.end();
|
||||
--back_1_it;
|
||||
while(now_it!=back_1_it){
|
||||
os<<*now_it<<", ";
|
||||
++now_it;
|
||||
}
|
||||
os<<*rbegin<<" }";
|
||||
os<<*back_1_it<<" }";
|
||||
}else{
|
||||
os<<"}";
|
||||
}
|
||||
|
15
src/test.cpp
15
src/test.cpp
@ -1,10 +1,11 @@
|
||||
#include <functional>
|
||||
#include <queue>
|
||||
|
||||
bool cmp(const int a,const int b){
|
||||
return a>b;
|
||||
}
|
||||
#include <iostream>
|
||||
#include <random>
|
||||
|
||||
int main(){
|
||||
std::priority_queue<int,std::deque<int>,std::less<int>> q;
|
||||
std::random_device rd;
|
||||
std::mt19937 rng(rd());
|
||||
std::uniform_int_distribution<int> ud(1,10);
|
||||
for(int i{1};i<=10;i++){
|
||||
std::cout<<ud(rng)<<'\n';
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user