// GLnode.cpp : Defines the entry point for the console application. // // test LLVM 2.0 #include#include #include #include #ifndef SAFE_DELETE_VECTOR #define SAFE_DELETE_VECTOR(x) { for(size_t __i__(0); __i__ < x.size(); ++__i__) delete(x.at(__i__)); x.clear(); } #endif template class GLvector : public std::vector { public: inline void remove(T t) { typename std::vector ::iterator pos = std::find(std::vector ::begin(), std::vector ::end(), t); if (pos != std::vector ::end()) erase(pos); } }; template class GLvectorF : public GLvector { class _find_if_pred { private: std::string _name; public: _find_if_pred(const std::string& name) : _name(name) { } template bool operator()(const TT* tt) { return ((_name.compare(tt->_name)) == 0); } }; public: int find(const std::string& name) { typename std::vector ::iterator pos = std::find_if(std::vector ::begin(), std::vector ::end(), _find_if_pred(name)); if (pos != std::vector ::end()) return (pos - std::vector ::begin()); return -1; } //if (pos != end()) T& find_ptr(const std::string& name) { typename std::vector ::iterator pos = std::find_if(std::vector ::begin(), std::vector ::end(), _find_if_pred(name)); return *pos; } const T& find_ptr(const std::string& name) const { typename std::vector ::const_iterator pos = std::find_if(std::vector ::begin(), std::vector ::end(), _find_if_pred(name)); return *pos; } }; class GLnode { class _for_each_pred { public: _for_each_pred(float time) : _time(time) { } template void operator()(T& t) const { t->_update(_time); } float _time; }; public: GLnode() { } GLnode(const std::string& name) : _name(name) { } virtual ~GLnode() { SAFE_DELETE_VECTOR(_vec); } virtual void update(float time) { std::for_each(_vec.begin(), _vec.end(), _for_each_pred(time)); } protected: virtual void _update(float time) const { } /// attribute public: std::string _name; /// operation public: GLvectorF _vec; }; char* itoa(int val, int base) { static char buf[32] = {0}; int i = 30; for(; val && i ; --i, val /= base) buf[i] = "0123456789abcdef"[val % base]; return &buf[i+1]; } int main (int argc, const char * argv[]) { // insert code here... std::cout << "Hello, World!\n"; GLnode _node; for (int i=0; i<10; i++) { char* ib = itoa(i, 10); _node._vec.push_back(new GLnode(ib)); } int index = _node._vec.find("9"); if (index != -1) { const GLnode* at = _node._vec.at(index); std::cout << "at= " << at->_name << std::endl; } const GLnode* ptr = _node._vec.find_ptr("9"); if (ptr != *_node._vec.end()) std::cout << "ptr= " << ptr->_name << std::endl; size_t size = _node._vec.size(); std::cout << "size= " << size << std::endl; const GLnode* begin = *_node._vec.begin(); const GLnode* end = *_node._vec.end(); return 0; }
๐ ️ Code Note & Usage
* Human + AI Collaboration: ์ฌ๊ธฐ ๋ฌธ์์ ์ฝ๋๋ ์ ๊ฐ ์ํฐ๋ฆฌ๋ก ๊ตฌ์กฐ๋ฅผ ์ก๊ณ , Google AI (๊ตฌ๊ธ๊ฒ์ AI ๋ชจ๋)๋ฅผ ๋ฌ๋ฌ ๋ณถ์๊ฐ๋ฉฐ(?) ์์ฑํ ์ํฐ๋ฆฌ ์ฝ๋ ๋ญ์น๋ค ์
๋๋ค.
* Free to Use: ๊ฐ์ธ์ ์ธ ์ทจ๋ฏธ๋ก ์ ๋ฆฌํ ๋ฌธ์์ ์ํฐ๋ฆฌ ์ฝ๋ ๋ญ์น ์ง๋ง, ๊ณต๋ถ ํ์ค๋ ์กฐ๊ธ์ด๋๋ง ๋์์ด ๋์ ๋ค๋ฉด ์์ ๋กญ๊ฒ ๊ฐ์ ธ๊ฐ์ ์ฌ์ฉํ์ค ์ ์๋๋ก ๊ณต๊ฐํฉ๋๋ค!
* ⚠️ Warning: ์ฌ๊ธฐ ์ํฐ๋ฆฌ ์ฝ๋ ๋ญ์น๋ฅผ, ๊ฐ์ ธ๊ฐ์ ๊ธฐํ์ฝ ๊ผญ ์ฌ์ฉ ํ์ ๋ค๋ฉด ๊ผญ ๋ณธ์ธ์ ํ๊ฒฝ์ ๋ง๊ฒ ๋ฒ๊ทธ๋ ์๋ฌ๋ฅผ ๊ผญ ํ ๋ฒ ๋ ํ์ธ(์ฃผ์)ํ๊ณ ์ฌ์ฉํด ์ฃผ์ธ์.
※ ์ฝ๋๋ฅผ ์ฌ์ฉํ ๋๋ ํญ์ ์ฃผ์๊ฐ ํ์ํฉ๋๋ค. ※
2011๋ 3์ 22์ผ ํ์์ผ
GLnode.cpp
Git ์ค์น๋ถํฐ ์ฌ์ฉ์ ๋ฑ๋ก๊น์ง์ ํต์ฌ์ ์ค์น ํ๋ก๊ทธ๋จ์ ์คํํ ํ, ํฐ๋ฏธ๋์์ ์ด๋ฆ๊ณผ ์ด๋ฉ์ผ์ ๋ฑ๋กํ๋ ๊ฒ์ ๋๋ค.
์ด์์ฒด์ (OS)๋ณ ์ค์น ๋ฐ ๋ฑ๋ก ๋ฐฉ๋ฒ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค. * Windows: ์์ธํ ๋ด์ฉ์ ์๋ ์ฒจ๋ถํ ๊นํ๋ธ ๊ธฐ์คํธ(GitHub Gist) ๋งํฌ๋ค์ด ๋ฌธ์๋ฅผ ํตํด ๋ฐ๋ก ๋ณต์ฌํ์ฌ ์ฌ์ฉํ์ค ์ ์์ต๋๋ค.
-
bool atob(const char * string) { if (!strcmp(string, "true")) return true; return false; }
-
Environment Variables: MAXSDKPATH=C:\Program Files (x86)\Autodesk\3ds Max 2010 SDK Sample source http://download.autodesk.com/media/...
-
/// CXXXView.cpp void CXXXView::OnInitialUpdate() { CView::OnInitialUpdate(); // TODO: Add your specialized code here and/or call the ...
๋๊ธ ์์:
๋๊ธ ์ฐ๊ธฐ