Skip to content

Instantly share code, notes, and snippets.

View yifu's full-sized avatar

Yves Baumes yifu

  • Montpellier, France
View GitHub Profile
#include <iostream>
bool f (const bool& b = bool(true))
{
return b;
}
using namespace std;
#include <ace/Time_Value.h>
#include <ctime>
#include <iostream>
#include <deque>
#include <vector>
#include <list>
#include <limits>
using namespace std;
@yifu
yifu / test_scheduler.cpp
Created September 18, 2012 15:12
ACE tests
#include <ace/Reactor.h>
#include <iostream>
using namespace std;
// --------------------------------------------------
// The goal is testing the shedule_timer() function
// correctly triggers an event.
// --------------------------------------------------
#include <iostream>
using namespace std;
// -----------------------------------------------
// Test the Aggregates propreties with gcc v3.4
// -----------------------------------------------
// The rules for a type for being an Aggregates are:
// - No user-defined ctor nor copy ctor.
#include <iostream>
#include <boost/array.hpp>
#include <boost/asio.hpp>
using namespace std;
using boost::asio::ip::tcp;
int main(int argc, char *argv[])
{
cout << "hello world." << endl;
@yifu
yifu / daytime_server.cpp
Created September 21, 2012 14:31
Asio tests.
#include <ctime>
#include <iostream>
#include <string>
#include <boost/asio.hpp>
using boost::asio::ip::tcp;
std::string make_daytime_string()
{
using namespace std; // For time_t, time and ctime;
@yifu
yifu / decltype.cpp
Created September 21, 2012 14:33
c++11 tests.
#include <iostream>
using namespace std;
/* Test the decltype feature from c++11 */
/* /Soft/mag/dev/tools/gcc-4.7.1/bin/g++ --std=c++11 lambdas.cpp && ./a.out */
// You can't use decltype operator in the return declaration part (why??).
// You need to use it in a special form. After the arrow...
template <typename T1, typename T2>
@yifu
yifu / for_each.cpp
Created September 21, 2012 14:34
c++11 tests.
#include <iostream>
using namespace std;
int main()
{
cout << "hello world." << endl;
for ( int i : { 2, 3, 4, 5, 79, 44 } )
{
cout << i << ", ";
@yifu
yifu / lambdas.cpp
Created September 21, 2012 14:34
c++11 tests.
#include <iostream>
using namespace std;
/* Test the lambda feature from c++11 */
/* /Soft/mag/dev/tools/gcc-4.7.1/bin/g++ --std=c++11 lambdas.cpp && ./a.out */
int main()
{
cout << "hello world." << endl;
@yifu
yifu / client.cpp
Created September 21, 2012 14:35
Chat room using asio.
#include <iostream>
#include <boost/asio.hpp>
// g++ -I /Soft/mag/dev/tools/boost-1.48.0/include/ -L /Soft/mag/dev/tools/boost-1.48.0/lib/ -l boost_system -lpthread client.cpp -o client
using namespace std;
using namespace boost;
using namespace boost::asio;
using namespace boost::asio::ip;