C++ provides a convenient STL container, tuple.
This is an example of using tuple.
auto tuple1 = tuple<int, string, float> (5, "qwe", 0.4f);
auto tuple2 = make_tuple(1, 4, "qqq");
cout<<get<0>(tuple1)<<get<1>(tuple2)<<endl;| path = '/home/junha/Projects/foundry/' | |
| import os | |
| def FindFile(path, format): | |
| result = [] | |
| for f in os.listdir(path): | |
| x = path + f | |
| if os.path.isdir(x): |
| use rand::Rng; | |
| use std::thread; | |
| use std::time; | |
| use std::time::Instant; | |
| use tokio::time::delay_for; | |
| const MAX: usize = 1000; | |
| async fn do_something(x: usize) -> usize { | |
| let mut rng = rand::thread_rng(); |
| use async_std::sync::{channel, Receiver}; | |
| use futures::future::FutureExt; | |
| use rand::rngs::SmallRng; | |
| use rand::FromEntropy; | |
| use rand::Rng; | |
| use std::thread; | |
| use std::time; | |
| use tokio::time::delay_for; | |
| #[derive(PartialEq, Clone, Debug)] |
| use std::thread; | |
| use std::sync::mpsc::{Receiver, channel}; | |
| use std::time::Duration; | |
| struct MyJoin<T> { | |
| handle: thread::JoinHandle<T>, | |
| signal: Receiver<()> | |
| } | |
| impl<T> MyJoin<T> { |
| // | |
| // Option1 - Explicit destruction | |
| // | |
| struct A; | |
| struct B; | |
| impl A { | |
| fn shutdown(self) { | |
| println!("Do some destruction"); | |
| } |