C++
- 4 ответа
- 0 вопросов
4
Вклад в тег
#include <string>
#include <iostream>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
int main()
{
std::string const path = "/home/Work/cpp/";
std::string name;
std::cout << "Input project name: ";
std::cin >> name;
if (name.empty())
{
std::cerr << "Empty file name" << std::endl;
return EXIT_FAILURE;
}
std::string const dir = path + name;
if (mkdir(dir.c_str(), 0755) == -1)
{
perror("Cannot create directory");
return EXIT_FAILURE;
}
std::cerr << dir << " created" << std::endl;
return EXIT_SUCCESS;
}
#include <boost/utility/enable_if.hpp>
template <class T, bool alt = false>
struct Shablon
{
template <bool C>
typename boost::enable_if_c<C>::type doSomething() {
((T*)this)->m_member.foo();
((T*)this)->someFoo();
}
template <bool C>
typename boost::disable_if_c<C>::type doSomething() {
}
void foo()
{
doSomething<alt>();
((T*)this)->foo2();
}
};