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 [ ";
|
os<<"array [ ";
|
||||||
if(!s.empty()){
|
if(!s.empty()){
|
||||||
auto now_it = s.begin();
|
auto now_it = s.begin();
|
||||||
const auto rbegin = s.rbegin();
|
const auto back_1_it = s.end()-1;
|
||||||
while(*now_it!=*rbegin){
|
while(now_it!=back_1_it){
|
||||||
os<<*now_it<<", ";
|
os<<*now_it<<", ";
|
||||||
++now_it;
|
++now_it;
|
||||||
}
|
}
|
||||||
os<<*rbegin<<" ]";
|
os<<*back_1_it<<" ]";
|
||||||
}else{
|
}else{
|
||||||
os<<"}";
|
os<<"}";
|
||||||
}
|
}
|
||||||
@ -36,12 +36,13 @@ std::ostream &operator<<(std::ostream &os, const std::set<T> &s){
|
|||||||
os<<"set { ";
|
os<<"set { ";
|
||||||
if(!s.empty()){
|
if(!s.empty()){
|
||||||
auto now_it = s.begin();
|
auto now_it = s.begin();
|
||||||
const auto rbegin = s.rbegin();
|
auto back_1_it = s.end();
|
||||||
while(*now_it!=*rbegin){
|
--back_1_it;
|
||||||
|
while(now_it!=back_1_it){
|
||||||
os<<*now_it<<", ";
|
os<<*now_it<<", ";
|
||||||
++now_it;
|
++now_it;
|
||||||
}
|
}
|
||||||
os<<*rbegin<<" }";
|
os<<*back_1_it<<" }";
|
||||||
}else{
|
}else{
|
||||||
os<<"}";
|
os<<"}";
|
||||||
}
|
}
|
||||||
|
15
src/test.cpp
15
src/test.cpp
@ -1,10 +1,11 @@
|
|||||||
#include <functional>
|
#include <iostream>
|
||||||
#include <queue>
|
#include <random>
|
||||||
|
|
||||||
bool cmp(const int a,const int b){
|
|
||||||
return a>b;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(){
|
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