Created
November 16, 2016 15:56
-
-
Save serialhex/fa874a8122fa6401acbbec73ba65c1e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "dir.h" | |
#include <arrayfire.h> | |
std::vector<std::string> get_tiff_files(std::string dir) { | |
std::regex re ("*\\.tiff?"); | |
return Dir::re_filter(Dir::get_files_in_dir(dir), re); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <windows.h> | |
#include <string> | |
#include <vector> | |
// #include <cctype> | |
#include <regex> | |
// #include <cstdio> | |
namespace Dir { | |
std::vector<std::string> get_files_in_dir(std::string folder) { | |
std::vector<std::string> names; | |
std::string search_path = folder + "*"; | |
WIN32_FIND_DATA fd; | |
HANDLE hFind = ::FindFirstFile(search_path.c_str(), &fd); | |
if(hFind != INVALID_HANDLE_VALUE) { | |
do { | |
// read all (real) files in current folder | |
// , delete '!' read other 2 default folder . and .. | |
if(! (fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ) { | |
names.push_back(folder + fd.cFileName); | |
} | |
} while(::FindNextFile(hFind, &fd)); | |
::FindClose(hFind); | |
} | |
return names; | |
} | |
std::vector<std::string> re_filter(std::vector<std::string> invec, std::regex rx) { | |
std::vector<std::string> out; | |
for (std::string s : invec) { | |
if (std::regex_search(s, rx)) { | |
out.push_back(s); | |
} | |
} | |
return out; | |
} | |
// std::vector<std::string> get_tiff_files(std::string dir) { | |
// std::regex re ("*\\.tiff?"); | |
// return re_filter(get_files_in_dir(dir), re); | |
// } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dir.cpp | |
d:\program files\arrayfire v3\include\af/algorithm.h(86): error C2059: syntax error: 'const' | |
d:\program files\arrayfire v3\include\af/algorithm.h(86): error C2059: syntax error: ')' | |
d:\program files\arrayfire v3\include\af/algorithm.h(100): error C2059: syntax error: 'const' | |
d:\program files\arrayfire v3\include\af/algorithm.h(100): error C2059: syntax error: ')' | |
d:\program files\arrayfire v3\include\af/algorithm.h(200): warning C4003: not enough actual parameters for macro 'min' | |
d:\program files\arrayfire v3\include\af/algorithm.h(200): error C2988: unrecognizable template declaration/definition | |
d:\program files\arrayfire v3\include\af/algorithm.h(200): error C2059: syntax error: 'const' | |
d:\program files\arrayfire v3\include\af/algorithm.h(200): error C2059: syntax error: ')' | |
d:\program files\arrayfire v3\include\af/algorithm.h(212): warning C4003: not enough actual parameters for macro 'max' | |
d:\program files\arrayfire v3\include\af/algorithm.h(212): error C2988: unrecognizable template declaration/definition | |
d:\program files\arrayfire v3\include\af/algorithm.h(212): error C2059: syntax error: ')' | |
d:\program files\arrayfire v3\include\af/algorithm.h(264): warning C4002: too many actual parameters for macro 'min' | |
d:\program files\arrayfire v3\include\af/algorithm.h(264): error C2143: syntax error: missing ')' before '&' | |
d:\program files\arrayfire v3\include\af/algorithm.h(264): error C2143: syntax error: missing ';' before '&' | |
d:\program files\arrayfire v3\include\af/algorithm.h(264): error C2182: 'array': illegal use of type 'void' | |
d:\program files\arrayfire v3\include\af/algorithm.h(264): error C2059: syntax error: ')' | |
d:\program files\arrayfire v3\include\af/algorithm.h(264): error C2143: syntax error: missing ';' before '<' | |
d:\program files\arrayfire v3\include\af/algorithm.h(264): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int | |
d:\program files\arrayfire v3\include\af/algorithm.h(264): error C2530: 'af::val': references must be initialized | |
d:\program files\arrayfire v3\include\af/algorithm.h(264): warning C4273: 'af::array': inconsistent dll linkage | |
d:\program files\arrayfire v3\include\af/algorithm.h(264): note: see previous definition of 'array' | |
d:\program files\arrayfire v3\include\af/algorithm.h(264): error C2530: 'af::idx': references must be initialized | |
d:\program files\arrayfire v3\include\af/algorithm.h(280): warning C4002: too many actual parameters for macro 'max' | |
d:\program files\arrayfire v3\include\af/algorithm.h(280): error C2143: syntax error: missing ')' before '&' | |
d:\program files\arrayfire v3\include\af/algorithm.h(280): error C2143: syntax error: missing ';' before '&' | |
d:\program files\arrayfire v3\include\af/algorithm.h(280): error C2182: 'array': illegal use of type 'void' | |
d:\program files\arrayfire v3\include\af/algorithm.h(280): warning C4273: 'af::array': inconsistent dll linkage | |
d:\program files\arrayfire v3\include\af/algorithm.h(264): note: see previous definition of 'array' | |
d:\program files\arrayfire v3\include\af/algorithm.h(280): error C2059: syntax error: ')' | |
d:\program files\arrayfire v3\include\af/algorithm.h(280): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int | |
d:\program files\arrayfire v3\include\af/algorithm.h(280): error C2086: 'int &af::val': redefinition | |
d:\program files\arrayfire v3\include\af/algorithm.h(264): note: see declaration of 'af::val' | |
d:\program files\arrayfire v3\include\af/algorithm.h(280): error C2530: 'af::val': references must be initialized | |
d:\program files\arrayfire v3\include\af/algorithm.h(280): error C2059: syntax error: '>' | |
d:\program files\arrayfire v3\include\af/algorithm.h(280): error C2086: 'int &af::idx': redefinition | |
d:\program files\arrayfire v3\include\af/algorithm.h(264): note: see declaration of 'af::idx' | |
d:\program files\arrayfire v3\include\af/algorithm.h(280): error C2530: 'af::idx': references must be initialized | |
d:\program files\arrayfire v3\include\af/algorithm.h(293): warning C4002: too many actual parameters for macro 'min' | |
d:\program files\arrayfire v3\include\af/algorithm.h(293): error C2988: unrecognizable template declaration/definition | |
d:\program files\arrayfire v3\include\af/algorithm.h(293): error C2143: syntax error: missing ')' before '*' | |
d:\program files\arrayfire v3\include\af/algorithm.h(293): error C2143: syntax error: missing ';' before '*' | |
d:\program files\arrayfire v3\include\af/algorithm.h(293): error C2182: 'T': illegal use of type 'void' | |
d:\program files\arrayfire v3\include\af/algorithm.h(293): error C2365: 'T': redefinition; previous definition was 'template parameter' | |
d:\program files\arrayfire v3\include\af/algorithm.h(293): note: see declaration of 'T' | |
d:\program files\arrayfire v3\include\af/algorithm.h(293): error C2059: syntax error: ')' | |
d:\program files\arrayfire v3\include\af/algorithm.h(293): error C2143: syntax error: missing ';' before '<' | |
d:\program files\arrayfire v3\include\af/algorithm.h(293): error C2062: type 'unsigned int' unexpected | |
d:\program files\arrayfire v3\include\af/algorithm.h(306): warning C4002: too many actual parameters for macro 'max' | |
d:\program files\arrayfire v3\include\af/algorithm.h(306): error C2062: type 'unsigned int' unexpected | |
d:\program files\arrayfire v3\include\af/algorithm.h(306): error C2059: syntax error: ')' | |
d:\program files\arrayfire v3\include\af/algorithm.h(317): error C2146: syntax error: missing ';' before identifier 'accum' | |
d:\program files\arrayfire v3\include\af/algorithm.h(317): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int | |
d:\program files\arrayfire v3\include\af/algorithm.h(317): error C2988: unrecognizable template declaration/definition | |
d:\program files\arrayfire v3\include\af/algorithm.h(317): error C2143: syntax error: missing ',' before '&' | |
d:\program files\arrayfire v3\include\af/algorithm.h(331): error C2146: syntax error: missing ';' before identifier 'scan' | |
d:\program files\arrayfire v3\include\af/algorithm.h(331): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int | |
d:\program files\arrayfire v3\include\af/algorithm.h(331): error C2988: unrecognizable template declaration/definition | |
d:\program files\arrayfire v3\include\af/algorithm.h(331): error C2143: syntax error: missing ',' before '&' | |
d:\program files\arrayfire v3\include\af/algorithm.h(345): error C2146: syntax error: missing ';' before identifier 'scanByKey' | |
d:\program files\arrayfire v3\include\af/algorithm.h(345): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int | |
d:\program files\arrayfire v3\include\af/algorithm.h(345): error C2988: unrecognizable template declaration/definition | |
d:\program files\arrayfire v3\include\af/algorithm.h(345): error C2143: syntax error: missing ',' before '&' | |
d:\program files\arrayfire v3\include\af/algorithm.h(356): error C2146: syntax error: missing ';' before identifier 'where' | |
d:\program files\arrayfire v3\include\af/algorithm.h(356): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int | |
d:\program files\arrayfire v3\include\af/algorithm.h(356): error C2988: unrecognizable template declaration/definition | |
d:\program files\arrayfire v3\include\af/algorithm.h(356): error C2143: syntax error: missing ',' before '&' | |
d:\program files\arrayfire v3\include\af/algorithm.h(367): error C2146: syntax error: missing ';' before identifier 'diff1' | |
d:\program files\arrayfire v3\include\af/algorithm.h(367): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int | |
d:\program files\arrayfire v3\include\af/algorithm.h(367): error C2988: unrecognizable template declaration/definition | |
d:\program files\arrayfire v3\include\af/algorithm.h(367): error C2143: syntax error: missing ',' before '&' | |
d:\program files\arrayfire v3\include\af/algorithm.h(378): error C2146: syntax error: missing ';' before identifier 'diff2' | |
d:\program files\arrayfire v3\include\af/algorithm.h(378): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int | |
d:\program files\arrayfire v3\include\af/algorithm.h(378): error C2988: unrecognizable template declaration/definition | |
d:\program files\arrayfire v3\include\af/algorithm.h(378): error C2143: syntax error: missing ',' before '&' | |
d:\program files\arrayfire v3\include\af/algorithm.h(390): error C2146: syntax error: missing ';' before identifier 'sort' | |
d:\program files\arrayfire v3\include\af/algorithm.h(390): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int | |
d:\program files\arrayfire v3\include\af/algorithm.h(390): error C2988: unrecognizable template declaration/definition | |
d:\program files\arrayfire v3\include\af/algorithm.h(390): error C2143: syntax error: missing ',' before '&' | |
d:\program files\arrayfire v3\include\af/algorithm.h(404): error C2182: 'sort': illegal use of type 'void' | |
d:\program files\arrayfire v3\include\af/algorithm.h(404): error C2491: 'af::sort': definition of dllimport data not allowed | |
d:\program files\arrayfire v3\include\af/algorithm.h(418): error C2182: 'sort': illegal use of type 'void' | |
d:\program files\arrayfire v3\include\af/algorithm.h(417): error C2374: 'af::sort': redefinition; multiple initialization | |
d:\program files\arrayfire v3\include\af/algorithm.h(403): note: see declaration of 'af::sort' | |
d:\program files\arrayfire v3\include\af/algorithm.h(418): error C2491: 'af::sort': definition of dllimport data not allowed | |
d:\program files\arrayfire v3\include\af/algorithm.h(429): error C2146: syntax error: missing ';' before identifier 'setUnique' | |
d:\program files\arrayfire v3\include\af/algorithm.h(429): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int | |
d:\program files\arrayfire v3\include\af/algorithm.h(429): error C2988: unrecognizable template declaration/definition | |
d:\program files\arrayfire v3\include\af/algorithm.h(429): error C2143: syntax error: missing ',' before '&' | |
d:\program files\arrayfire v3\include\af/algorithm.h(441): error C2146: syntax error: missing ';' before identifier 'setUnion' | |
d:\program files\arrayfire v3\include\af/algorithm.h(441): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int | |
d:\program files\arrayfire v3\include\af/algorithm.h(441): error C2988: unrecognizable template declaration/definition | |
d:\program files\arrayfire v3\include\af/algorithm.h(441): error C2143: syntax error: missing ',' before '&' | |
d:\program files\arrayfire v3\include\af/algorithm.h(453): error C2146: syntax error: missing ';' before identifier 'setIntersect' | |
d:\program files\arrayfire v3\include\af/algorithm.h(453): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int | |
d:\program files\arrayfire v3\include\af/algorithm.h(453): error C2988: unrecognizable template declaration/definition | |
d:\program files\arrayfire v3\include\af/algorithm.h(453): error C2143: syntax error: missing ',' before '&' | |
d:\program files\arrayfire v3\include\af/arith.h(15): error C2989: 'af::array': class template has already been declared as a non-class template | |
d:\program files\arrayfire v3\include\af/algorithm.h(16): note: see declaration of 'af::array' | |
d:\program files\arrayfire v3\include\af/arith.h(25): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int | |
d:\program files\arrayfire v3\include\af/arith.h(25): warning C4273: 'af::array': inconsistent dll linkage | |
d:\program files\arrayfire v3\include\af/algorithm.h(280): note: see previous definition of 'array' | |
d:\program files\arrayfire v3\include\af/arith.h(28): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int | |
d:\program files\arrayfire v3\include\af/arith.h(28): error C2374: 'af::array': redefinition; multiple initialization | |
d:\program files\arrayfire v3\include\af/arith.h(25): note: see declaration of 'af::array' | |
d:\program files\arrayfire v3\include\af/arith.h(28): error C2491: 'af::array': definition of dllimport data not allowed | |
d:\program files\arrayfire v3\include\af/arith.h(31): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int | |
d:\program files\arrayfire v3\include\af/arith.h(31): error C2374: 'af::array': redefinition; multiple initialization | |
d:\program files\arrayfire v3\include\af/arith.h(25): note: see declaration of 'af::array' | |
d:\program files\arrayfire v3\include\af/arith.h(31): error C2491: 'af::array': definition of dllimport data not allowed | |
d:\program files\arrayfire v3\include\af/arith.h(41): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int | |
d:\program files\arrayfire v3\include\af/arith.h(41): error C2374: 'af::array': redefinition; multiple initialization | |
d:\program files\arrayfire v3\include\af/arith.h(25): note: see declaration of 'af::array' | |
d:\program files\arrayfire v3\include\af/arith.h(41): error C2491: 'af::array': definition of dllimport data not allowed | |
d:\program files\arrayfire v3\include\af/arith.h(44): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int | |
d:\program files\arrayfire v3\include\af/arith.h(44): error C2374: 'af::array': redefinition; multiple initialization | |
d:\program files\arrayfire v3\include\af/arith.h(25): note: see declaration of 'af::array' | |
d:\program files\arrayfire v3\include\af/arith.h(44): error C2491: 'af::array': definition of dllimport data not allowed | |
d:\program files\arrayfire v3\include\af/arith.h(47): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int | |
d:\program files\arrayfire v3\include\af/arith.h(47): error C2374: 'af::array': redefinition; multiple initialization | |
d:\program files\arrayfire v3\include\af/arith.h(25): note: see declaration of 'af::array' | |
d:\program files\arrayfire v3\include\af/arith.h(47): error C2491: 'af::array': definition of dllimport data not allowed | |
d:\program files\arrayfire v3\include\af/arith.h(59): error C2146: syntax error: missing ';' before identifier 'clamp' | |
d:\program files\arrayfire v3\include\af/arith.h(59): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int | |
d:\program files\arrayfire v3\include\af/arith.h(59): error C2988: unrecognizable template declaration/definition | |
d:\program files\arrayfire v3\include\af/arith.h(59): error C2143: syntax error: missing ',' before '&' | |
d:\program files\arrayfire v3\include\af/arith.h(64): error C2146: syntax error: missing ';' before identifier 'clamp' | |
d:\program files\arrayfire v3\include\af/arith.h(64): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int | |
d:\program files\arrayfire v3\include\af/arith.h(64): error C2988: unrecognizable template declaration/definition | |
d:\program files\arrayfire v3\include\af/arith.h(64): error C2143: syntax error: missing ',' before '&' | |
d:\program files\arrayfire v3\include\af/arith.h(69): error C2146: syntax error: missing ';' before identifier 'clamp' | |
d:\program files\arrayfire v3\include\af/arith.h(69): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int | |
d:\program files\arrayfire v3\include\af/arith.h(69): error C2988: unrecognizable template declaration/definition | |
d:\program files\arrayfire v3\include\af/arith.h(69): error C2143: syntax error: missing ',' before '&' | |
d:\program files\arrayfire v3\include\af/arith.h(75): error C2146: syntax error: missing ';' before identifier 'clamp' | |
d:\program files\arrayfire v3\include\af/arith.h(75): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int | |
d:\program files\arrayfire v3\include\af/arith.h(75): error C2988: unrecognizable template declaration/definition | |
d:\program files\arrayfire v3\include\af/arith.h(75): error C2143: syntax error: missing ',' before '&' | |
d:\program files\arrayfire v3\include\af/arith.h(87): error C2146: syntax error: missing ';' before identifier 'rem' | |
d:\program files\arrayfire v3\include\af/arith.h(87): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int | |
d:\program files\arrayfire v3\include\af/arith.h(87): error C2988: unrecognizable template declaration/definition | |
d:\program files\arrayfire v3\include\af/arith.h(87): error C2143: syntax error: missing ',' before '&' | |
d:\program files\arrayfire v3\include\af/arith.h(90): error C2146: syntax error: missing ';' before identifier 'rem' | |
d:\program files\arrayfire v3\include\af/arith.h(90): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int | |
d:\program files\arrayfire v3\include\af/arith.h(90): error C2988: unrecognizable template declaration/definition | |
d:\program files\arrayfire v3\include\af/arith.h(90): error C2143: syntax error: missing ',' before '&' | |
d:\program files\arrayfire v3\include\af/arith.h(93): error C2146: syntax error: missing ';' before identifier 'rem' | |
d:\program files\arrayfire v3\include\af/arith.h(93): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int | |
d:\program files\arrayfire v3\include\af/arith.h(93): error C2988: unrecognizable template declaration/definition | |
d:\program files\arrayfire v3\include\af/arith.h(93): fatal error C1003: error count exceeds 100; stopping compilation |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment