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>
#include <vector>
using namespace std;
// clang++ -std=c++11 -stdlib=libc++ -Weverything mergesort.cpp
vector<int> merge_sort(vector<int> v);
vector<int> merge(vector<int> left, vector<int> right);
ostream& operator << (ostream& os, vector<int> v);
#include <iostream>
#include <memory>
struct A
{
virtual void process();
};
struct B : public A
{
#include <iostream>
int main()
{
char pre [4] = "123";
char buf [4] = "123";
char post[4] = "123";
std::cin.width(3);
std::cin >> buf;
std::cout << pre << "," << buf << "," << post << std::endl;
#include <iostream>
void f(int) { std::cout << "f(int)" << std::endl; }
void f(char *) { std::cout << "f(char *)" << std::endl; }
int main()
{
std::cout << "hello world" << std::endl;
#include <iostream>
void f(int) { std::cout << "f(int)" << std::endl; }
void f(char *) { std::cout << "f(char *)" << std::endl; }
int main()
{
std::cout << "hello world" << std::endl;
#include <iostream>
void f(int) { std::cout << "f(int)" << std::endl; }
void f(char *) { std::cout << "f(char *)" << std::endl; }
int main()
{
std::cout << "hello world" << std::endl;
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <netdb.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <ace/OS.h>
#include <iostream>
#include <unistd.h>
int main()
{
{
char name [1024] = "";
const int result = gethostname( name, sizeof name );
std::cout << "result [" << result << "] name[" << name << "]" << std::endl;
}
#include <ace/Semaphore.h>
#include <iostream>
int main()
{
std::cout << "hello wordl" << std::endl;
ACE_Semaphore signal( 0, USYNC_THREAD, "test_ACE_sem" );
signal.dump();
signal.release();
#include <iostream>
#include "semaphore.h"
int main()
{
std::cout << "hello world" << std::endl;
sem_t temp;
const int result = sem_init( &temp, 0, 0 );
std::cout << " result = [" << result << "]" << std::endl;