Executing or importing a schema to DB on sqlite is really easy.
where test.db is the test database.
sqlite3.exe test.db < schema.sql
where test.db is the test database.
sqlite3.exe test.db < schema.sql
This variable can for example be used for logging purposes.
static const char __func__[] = "function-name";
int arr[] = {1,2,3,5};
for(auto &i : arr) {
i += 2;
}
std::vector<int> myVector (arr, arr+4);
for (auto j: myVector)
std::cout << j<< std::endl;
enum class MyEnum
{
VALUE1,
VALUE2 = 10,
VALUE3
};
if (MyEnum::VALUE3 == 11) {...}
enum class MyEnumLong : unsigned longEnum class type is user defined so we can define operators. By default Enum class has only assignment, initialization, and comparisons operator.
{
LVALUE1,
LVALUE2 = 10,
LVALUE3
};
enum class color { green, yellow, red };
color& operator++(color& t)
// prefix increment: ++
{
switch (t) {
case color::green: return t = color::yellow;
case color::yellow: return t = color::red;
case color::red: return t = color::green;
}
}
color next = ++light; // next becomes color::green
#include "namespaces.h"
#include <iostream>
namespace mycode {
void foo() {
std::cout << "foo() called in the mycode namespace" << std::endl;
}
}
To call the namespace-enabled version of foo(), prepend the namespace onto the function name by using :: also called the scope resolution operator as follows.mycode::foo(); // Calls the "foo" function in the "mycode" namespace
using std::cout;
using std::cout; cout << "Hello, World!" << std::endl;