xxxxxxxxxx
#include <iostream>
#include <list>
using namespace std;
int main() {
// create a list
list<int> numbers = {1, 2, 3};
// display the original list
cout << "Initial List: ";
for(int number: numbers) {
cout << number << ", ";
}
// add element at the beginning
numbers.push_front(0);
// add element at the end
numbers.push_back(4);
// display the modified list
cout << endl << "Final List: ";
for(int number : numbers) {
cout << number << ", ";
}
return 0;
}
xxxxxxxxxx
list<int> myList = list<int>();
//add a 4 to the end of the list
myList.push_back(4);
//add a 5 to the begining of the list
myList.push_front(5);
xxxxxxxxxx
// C++ code to demonstrate the working of assign()
#include <iostream>
#include <list> // for list operations
using namespace std;
int main()
{
// declaring list
list<int> list1;
list<int> list2;
list<int> list3;
// initializing array
int arr[10] = { 1, 2, 3, 4 };
// using assign() to insert multiple numbers
// creates 4 occurrences of "2"
list1.assign(4,2);
// Printing the assigned list
cout << "The list after inserting multiple elements is : ";
for (list<int>::iterator i=list1.begin(); i!=list1.end(); i++)
cout << *i << " ";
cout << endl;
// using assign() to copy elements of list to other
// assigns 4 occurrences of "2"
list2.assign(list1.begin(),list1.end());
// Printing the assigned list
cout << "The list after copying list elements is : ";
for (list<int>::iterator i=list2.begin(); i!=list2.end(); i++)
cout << *i << " ";
cout << endl;
// using assign() to copy elements of array to list
// assigns array elements
list3.assign(arr,arr+4);
// Printing the assigned list
cout << "The list after copying array elements is : ";
for (list<int>::iterator i=list3.begin(); i!=list3.end(); i++)
cout << *i << " ";
cout << endl;
}
xxxxxxxxxx
params {
config_profile_description = 'The University of Eastern Finland SLURM cluster profile'
config_profile_contact = 'Oskari Timonen'
config_profile_url = ''
}
singularity {
enabled = true
autoMounts = true
cacheDir = "/some/fast/directory/for/apptainer/containers"
}
process {
executor = 'slurm'
queue = 'small'
queueSize = 16
// submitRateLimit = '20/2min'
// submitRateLimit = '1min'
maxSubmitJobs = 20
errorStrategy = 'retry'
maxRetries = 5
retry.delay = '1min'
time = '1.d'
cpus = 8
memory = '20 GB'
clusterOptions = '--job-name=nfSLURM \
--output=/directory/for/slurm/outputs/2024-03-08_output.txt \
--error=/directory/for/slurm/error/outputs/2024-03-08_log-error.txt \
}
params {
max_memory = 50.GB
max_cpus = 32
max_time = 3.d
}