I disclaim thee, o’ liability
Const References to Temporary Objects
Consider the following code snippet:
1#include <iostream>
2
3int GetInt() {
4 int x = 1;
5 return x;
6}
7
8int main() {
9 const int& x = GetInt();
10 std::cout << x << std::endl;
11 return 0;
12}
In particular, pay attention to line #9. Is it guaranteed to be safe?
…Pelican Setup
Install Pelican:
1sudo -H pip install pelican Markdown typogrify
Install Pelican themes
1git clone --recursive https://github.com/getpelican/pelican-themes
2sudo /usr/local/bin/pelican-themes --install pelican-themes/Flex
3sudo chmod 755 /usr/local/lib/python2.7/dist-packages/pelican/themes/Flex
Install Pelican plugins
1git clone --recursive https://github.com/getpelican/pelican-plugins
Fetch blog sources
1git clone git@github.com:j4nu5/j4nu5.github.io.git
2cd j4nu5.github.io.git
3git fetch
4git checkout source
Setup for development
…USACO setup
USACO is fun. Though it is fairly easy to get up and running on the platform, there remain a few repetitive steps during problem solving that can be automated. Here is a brief summary of my automation steps:
- Use a template. Here is mine. Save it as template.cpp:
- Save this script as solve.sh in the same directory as above:
- All done!
Whenever you’re ready to begin coding a solution, simply execute
./solve.sh PROBLEM_NAME
All the best!
…