├── .gitignore ├── MyLibrary ├── Binary Search Tree │ ├── Binary Search Tree.vcxproj │ ├── Binary Search Tree.vcxproj.filters │ ├── binary_search_tree.h │ └── binary_tree_node.h ├── Forward List │ ├── Forward List.vcxproj │ ├── Forward List.vcxproj.filters │ ├── forward_list.h │ ├── forward_list_const_iterator.h │ ├── forward_list_iterator.h │ ├── forward_list_node.h │ └── forward_list_node_base.h ├── Graph │ ├── Graph.vcxproj │ ├── Graph.vcxproj.filters │ ├── graph.h │ ├── graph_node.h │ └── graph_type.h ├── List │ ├── List.vcxproj │ ├── List.vcxproj.filters │ ├── list.h │ ├── list_const_iterator.h │ ├── list_iterator.h │ ├── list_node.h │ └── list_node_base.h └── MyLibrary.sln └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | build/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | artifacts/ 46 | 47 | *_i.c 48 | *_p.c 49 | *_i.h 50 | *.ilk 51 | *.meta 52 | *.obj 53 | *.pch 54 | *.pdb 55 | *.pgc 56 | *.pgd 57 | *.rsp 58 | *.sbr 59 | *.tlb 60 | *.tli 61 | *.tlh 62 | *.tmp 63 | *.tmp_proj 64 | *.log 65 | *.vspscc 66 | *.vssscc 67 | .builds 68 | *.pidb 69 | *.svclog 70 | *.scc 71 | 72 | # Chutzpah Test files 73 | _Chutzpah* 74 | 75 | # Visual C++ cache files 76 | ipch/ 77 | *.aps 78 | *.ncb 79 | *.opensdf 80 | *.sdf 81 | *.cachefile 82 | 83 | # Visual Studio profiler 84 | *.psess 85 | *.vsp 86 | *.vspx 87 | 88 | # TFS 2012 Local Workspace 89 | $tf/ 90 | 91 | # Guidance Automation Toolkit 92 | *.gpState 93 | 94 | # ReSharper is a .NET coding add-in 95 | _ReSharper*/ 96 | *.[Rr]e[Ss]harper 97 | *.DotSettings.user 98 | 99 | # JustCode is a .NET coding add-in 100 | .JustCode 101 | 102 | # TeamCity is a build add-in 103 | _TeamCity* 104 | 105 | # DotCover is a Code Coverage Tool 106 | *.dotCover 107 | 108 | # NCrunch 109 | _NCrunch_* 110 | .*crunch*.local.xml 111 | nCrunchTemp_* 112 | 113 | # MightyMoose 114 | *.mm.* 115 | AutoTest.Net/ 116 | 117 | # Web workbench (sass) 118 | .sass-cache/ 119 | 120 | # Installshield output folder 121 | [Ee]xpress/ 122 | 123 | # DocProject is a documentation generator add-in 124 | DocProject/buildhelp/ 125 | DocProject/Help/*.HxT 126 | DocProject/Help/*.HxC 127 | DocProject/Help/*.hhc 128 | DocProject/Help/*.hhk 129 | DocProject/Help/*.hhp 130 | DocProject/Help/Html2 131 | DocProject/Help/html 132 | 133 | # Click-Once directory 134 | publish/ 135 | 136 | # Publish Web Output 137 | *.[Pp]ublish.xml 138 | *.azurePubxml 139 | # TODO: Comment the next line if you want to checkin your web deploy settings 140 | # but database connection strings (with potential passwords) will be unencrypted 141 | *.pubxml 142 | *.publishproj 143 | 144 | # NuGet Packages 145 | *.nupkg 146 | # The packages folder can be ignored because of Package Restore 147 | **/packages/* 148 | # except build/, which is used as an MSBuild target. 149 | !**/packages/build/ 150 | # Uncomment if necessary however generally it will be regenerated when needed 151 | #!**/packages/repositories.config 152 | 153 | # Windows Azure Build Output 154 | csx/ 155 | *.build.csdef 156 | 157 | # Windows Store app package directory 158 | AppPackages/ 159 | 160 | # Visual Studio cache files 161 | # files ending in .cache can be ignored 162 | *.[Cc]ache 163 | # but keep track of directories ending in .cache 164 | !*.[Cc]ache/ 165 | 166 | # Others 167 | ClientBin/ 168 | [Ss]tyle[Cc]op.* 169 | ~$* 170 | *~ 171 | *.dbmdl 172 | *.dbproj.schemaview 173 | *.pfx 174 | *.publishsettings 175 | node_modules/ 176 | orleans.codegen.cs 177 | 178 | # RIA/Silverlight projects 179 | Generated_Code/ 180 | 181 | # Backup & report files from converting an old project file 182 | # to a newer Visual Studio version. Backup files are not needed, 183 | # because we have git ;-) 184 | _UpgradeReport_Files/ 185 | Backup*/ 186 | UpgradeLog*.XML 187 | UpgradeLog*.htm 188 | 189 | # SQL Server files 190 | *.mdf 191 | *.ldf 192 | 193 | # Business Intelligence projects 194 | *.rdl.data 195 | *.bim.layout 196 | *.bim_*.settings 197 | 198 | # Microsoft Fakes 199 | FakesAssemblies/ 200 | 201 | # Node.js Tools for Visual Studio 202 | .ntvs_analysis.dat 203 | 204 | # Visual Studio 6 build log 205 | *.plg 206 | 207 | # Visual Studio 6 workspace options file 208 | *.opt 209 | 210 | # Visual Studio LightSwitch build output 211 | **/*.HTMLClient/GeneratedArtifacts 212 | **/*.DesktopClient/GeneratedArtifacts 213 | **/*.DesktopClient/ModelManifest.xml 214 | **/*.Server/GeneratedArtifacts 215 | **/*.Server/ModelManifest.xml 216 | _Pvt_Extensions 217 | -------------------------------------------------------------------------------- /MyLibrary/Binary Search Tree/Binary Search Tree.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | {A868CD63-08A9-4B2C-84C4-786920A5AECF} 15 | Win32Proj 16 | BinarySearchTree 17 | 10.0.14393.0 18 | 19 | 20 | 21 | Application 22 | true 23 | v141 24 | Unicode 25 | 26 | 27 | Application 28 | false 29 | v141 30 | true 31 | Unicode 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | true 45 | 46 | 47 | false 48 | 49 | 50 | 51 | 52 | 53 | Level3 54 | Disabled 55 | WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) 56 | true 57 | D:\Programming\Git\MyLibrary\MyLibrary\Unit Test;%(AdditionalIncludeDirectories) 58 | 59 | 60 | Console 61 | true 62 | 63 | 64 | 65 | 66 | Level3 67 | 68 | 69 | MaxSpeed 70 | true 71 | true 72 | WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) 73 | true 74 | 75 | 76 | Console 77 | true 78 | true 79 | true 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /MyLibrary/Binary Search Tree/Binary Search Tree.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | 26 | 27 | Source Files 28 | 29 | 30 | -------------------------------------------------------------------------------- /MyLibrary/Binary Search Tree/binary_search_tree.h: -------------------------------------------------------------------------------- 1 | /** 2 | * binary_search_tree.h 3 | * 4 | * @author Raul Butuc 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | #include 11 | #include "binary_tree_node.h" 12 | 13 | namespace my_library { 14 | 15 | template 16 | class binary_search_tree { 17 | 18 | public: 19 | binary_search_tree(); 20 | void display_pre_order(); 21 | void display_in_order(); 22 | void display_post_order(); 23 | bool empty(); 24 | void insert(_Tp); 25 | void insert(std::vector<_Tp>); 26 | void remove(_Tp); 27 | void remove(std::vector<_Tp>); 28 | bool search(_Tp); 29 | ~binary_search_tree(); 30 | 31 | private: 32 | binary_tree_node<_Tp>* m_pHead; 33 | 34 | void display_pre_order(binary_tree_node<_Tp>*); 35 | void display_in_order(binary_tree_node<_Tp>*); 36 | void display_post_order(binary_tree_node<_Tp>*); 37 | void display_node(binary_tree_node<_Tp>*); 38 | binary_tree_node<_Tp>* get_min_value_node(binary_tree_node<_Tp>*); 39 | binary_tree_node<_Tp>* get_node_by_value(binary_tree_node<_Tp>*, _Tp); 40 | void get_nodes_in_post_order(binary_tree_node<_Tp>*, std::queue*>&); 41 | void insert(binary_tree_node<_Tp>**, binary_tree_node<_Tp>*, _Tp, bool); 42 | binary_tree_node<_Tp>* remove(binary_tree_node<_Tp>*, _Tp); 43 | bool search(binary_tree_node<_Tp>*, _Tp); 44 | 45 | }; 46 | 47 | template 48 | binary_search_tree<_Tp>::binary_search_tree() : m_pHead(nullptr) {} 49 | 50 | template 51 | void binary_search_tree<_Tp>::display_pre_order() { 52 | if (m_pHead != nullptr) { 53 | this->display_pre_order(m_pHead); 54 | } 55 | } 56 | 57 | template 58 | void binary_search_tree<_Tp>::display_pre_order(binary_tree_node<_Tp>* curr) { 59 | this->display_node(curr); 60 | 61 | if (curr->left != nullptr) { 62 | this->display_pre_order(curr->left); 63 | } 64 | 65 | if (curr->right != nullptr) { 66 | this->display_pre_order(curr->right); 67 | } 68 | } 69 | 70 | template 71 | void binary_search_tree<_Tp>::display_in_order() { 72 | if (m_pHead != nullptr) { 73 | this->display_in_order(m_pHead); 74 | } 75 | } 76 | 77 | template 78 | void binary_search_tree<_Tp>::display_in_order(binary_tree_node<_Tp>* curr) { 79 | if (curr->left != nullptr) { 80 | this->display_in_order(curr->left); 81 | } 82 | 83 | this->display_node(curr); 84 | 85 | if (curr->right != nullptr) { 86 | this->display_in_order(curr->right); 87 | } 88 | } 89 | 90 | template 91 | void binary_search_tree<_Tp>::display_post_order() { 92 | if (m_pHead != nullptr) { 93 | this->display_post_order(m_pHead); 94 | } 95 | } 96 | 97 | template 98 | void binary_search_tree<_Tp>::display_post_order(binary_tree_node<_Tp>* curr) { 99 | if (curr->left != nullptr) { 100 | this->display_post_order(curr->left); 101 | } 102 | 103 | if (curr->right != nullptr) { 104 | this->display_post_order(curr->right); 105 | } 106 | 107 | this->display_node(curr); 108 | } 109 | 110 | template 111 | void binary_search_tree<_Tp>::display_node(binary_tree_node<_Tp>* curr) { 112 | std::cout << curr->value << " "; 113 | } 114 | 115 | template 116 | bool binary_search_tree<_Tp>::empty() { 117 | return m_pHead == nullptr; 118 | } 119 | 120 | template 121 | binary_tree_node<_Tp>* binary_search_tree<_Tp>::get_min_value_node(binary_tree_node<_Tp>* curr) { 122 | while (curr->left != nullptr) { 123 | curr = curr->left; 124 | } 125 | 126 | return curr; 127 | } 128 | 129 | template 130 | binary_tree_node<_Tp>* binary_search_tree<_Tp>::get_node_by_value(binary_tree_node<_Tp>* curr, 131 | _Tp val){ 132 | if (curr != nullptr) { 133 | if (curr->value == val) { 134 | return curr; 135 | } 136 | 137 | if (curr->value > val) { 138 | this->search(curr->left, val); 139 | } 140 | else { 141 | this->search(curr->right, val); 142 | } 143 | } 144 | 145 | return nullptr; 146 | } 147 | 148 | template 149 | void binary_search_tree<_Tp>::get_nodes_in_post_order(binary_tree_node<_Tp>* curr, 150 | std::queue*>& nodes) { 151 | if (curr != nullptr) { 152 | this->get_nodes_in_post_order(curr->left, nodes); 153 | this->get_nodes_in_post_order(curr->right, nodes); 154 | nodes.push(curr); 155 | } 156 | } 157 | 158 | template 159 | void binary_search_tree<_Tp>::insert(_Tp val) { 160 | this->insert(&m_pHead, nullptr, val, false); 161 | } 162 | 163 | template 164 | void binary_search_tree<_Tp>::insert(std::vector<_Tp> vals) { 165 | vals = std::vector<_Tp>(vals.rbegin(), vals.rend()); 166 | 167 | while (!vals.empty()) { 168 | _Tp val = vals.back(); 169 | vals.pop_back(); 170 | this->insert(&m_pHead, nullptr, val, false); 171 | } 172 | } 173 | 174 | template 175 | void binary_search_tree<_Tp>::insert(binary_tree_node<_Tp>** curr, binary_tree_node<_Tp>* parent, 176 | _Tp val, bool isLeftChild) { 177 | if (*curr == nullptr) { 178 | *curr = new binary_tree_node<_Tp>(); 179 | (*curr)->value = val; 180 | 181 | if (parent != nullptr) { 182 | if (isLeftChild) { 183 | parent->left = *curr; 184 | } 185 | else { 186 | parent->right = *curr; 187 | } 188 | } 189 | } 190 | else { 191 | if ((*curr)->value > val) { 192 | this->insert(&((*curr)->left), *curr, val, true); 193 | } 194 | else { 195 | this->insert(&((*curr)->right), *curr, val, false); 196 | } 197 | } 198 | } 199 | 200 | template 201 | void binary_search_tree<_Tp>::remove(_Tp val) { 202 | if (m_pHead != nullptr) { 203 | binary_tree_node<_Tp>* node = this->remove(m_pHead, val); 204 | } 205 | } 206 | 207 | template 208 | void binary_search_tree<_Tp>::remove(std::vector<_Tp> vals) { 209 | if (m_pHead != nullptr) { 210 | binary_tree_node<_Tp>* node; 211 | vals = std::vector<_Tp>(vals.rbegin(), vals.rend()); 212 | 213 | while (!vals.empty()) { 214 | _Tp val = vals.back(); 215 | vals.pop_back(); 216 | node = this->remove(m_pHead, val); 217 | } 218 | } 219 | } 220 | 221 | template 222 | binary_tree_node<_Tp>* binary_search_tree<_Tp>::remove(binary_tree_node<_Tp>* curr, _Tp val) { 223 | if (curr == nullptr) { 224 | return curr; 225 | } 226 | 227 | if (curr->value > val) { 228 | curr->left = this->remove(curr->left, val); 229 | } 230 | else if (curr->value < val) { 231 | curr->right = this->remove(curr->right, val); 232 | } 233 | else { 234 | if (curr->left == nullptr && curr->right == nullptr) { 235 | delete curr; 236 | curr = nullptr; 237 | } 238 | else if (curr->left == nullptr) { 239 | binary_tree_node<_Tp>* temp = curr; 240 | curr = curr->right; 241 | delete temp; 242 | } 243 | else if (curr->right == nullptr) { 244 | binary_tree_node<_Tp>* temp = curr; 245 | curr = curr->left; 246 | delete temp; 247 | } 248 | else { 249 | binary_tree_node<_Tp>* temp = this->get_min_value_node(curr->right); 250 | curr->value = temp->value; 251 | curr->right = this->remove(curr->right, temp->value); 252 | } 253 | } 254 | 255 | return curr; 256 | } 257 | 258 | template 259 | bool binary_search_tree<_Tp>::search(_Tp val) { 260 | return this->search(m_pHead, val); 261 | } 262 | 263 | template 264 | bool binary_search_tree<_Tp>::search(binary_tree_node<_Tp>* curr, _Tp val) { 265 | if (curr != nullptr) { 266 | if (curr->value == val) { 267 | return true; 268 | } 269 | 270 | if (curr->value > val) { 271 | this->search(curr->left, val); 272 | } 273 | else { 274 | this->search(curr->right, val); 275 | } 276 | } 277 | 278 | return false; 279 | } 280 | 281 | template 282 | binary_search_tree<_Tp>::~binary_search_tree() { 283 | std::queue*> nodes; 284 | 285 | this->get_nodes_in_post_order(m_pHead, nodes); 286 | 287 | while (!nodes.empty()) { 288 | binary_tree_node<_Tp>* node = nodes.front(); 289 | this->remove(node->value); 290 | nodes.pop(); 291 | } 292 | } 293 | 294 | } 295 | -------------------------------------------------------------------------------- /MyLibrary/Binary Search Tree/binary_tree_node.h: -------------------------------------------------------------------------------- 1 | /** 2 | * binary_tree_node.h 3 | * 4 | * @author Raul Butuc 5 | */ 6 | 7 | #pragma once 8 | 9 | #include "binary_search_tree.h" 10 | 11 | namespace my_library { 12 | 13 | template class binary_search_tree; 14 | 15 | template 16 | class binary_tree_node { 17 | 18 | friend class binary_search_tree<_Tp>; 19 | 20 | private: 21 | binary_tree_node<_Tp>* left; 22 | binary_tree_node<_Tp>* right; 23 | _Tp value; 24 | 25 | public: 26 | binary_tree_node(); 27 | ~binary_tree_node(); 28 | 29 | }; 30 | 31 | template 32 | binary_tree_node<_Tp>::binary_tree_node() 33 | : left(nullptr), right(nullptr) {} 34 | 35 | template 36 | binary_tree_node<_Tp>::~binary_tree_node() {} 37 | 38 | } 39 | -------------------------------------------------------------------------------- /MyLibrary/Forward List/Forward List.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | {BEE915DE-78FF-4ED4-BF26-018CDF08AB7A} 25 | Win32Proj 26 | ForwardList 27 | 10.0.14393.0 28 | 29 | 30 | 31 | Application 32 | true 33 | v141 34 | Unicode 35 | 36 | 37 | Application 38 | false 39 | v141 40 | true 41 | Unicode 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | true 55 | 56 | 57 | false 58 | 59 | 60 | 61 | 62 | 63 | Level3 64 | Disabled 65 | WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) 66 | true 67 | D:\Programming\Git\MyLibrary\MyLibrary\Unit Test;%(AdditionalIncludeDirectories) 68 | 69 | 70 | Console 71 | true 72 | D:\Programming\Git\MyLibrary\MyLibrary\Debug\UnitTest.lib;%(AdditionalDependencies) 73 | 74 | 75 | 76 | 77 | Level3 78 | 79 | 80 | MaxSpeed 81 | true 82 | true 83 | WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) 84 | true 85 | D:\Programming\Git\MyLibrary\MyLibrary\Unit Test;%(AdditionalIncludeDirectories) 86 | 87 | 88 | Console 89 | true 90 | true 91 | true 92 | D:\Programming\Git\MyLibrary\MyLibrary\Release\UnitTest.lib;%(AdditionalDependencies) 93 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /MyLibrary/Forward List/Forward List.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | 23 | 24 | Header Files 25 | 26 | 27 | Header Files 28 | 29 | 30 | Header Files 31 | 32 | 33 | Header Files 34 | 35 | 36 | Header Files 37 | 38 | 39 | -------------------------------------------------------------------------------- /MyLibrary/Forward List/forward_list.h: -------------------------------------------------------------------------------- 1 | /** 2 | * forward_list.h 3 | * 4 | * @author Raul Butuc 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | #include "forward_list_node.h" 11 | #include "forward_list_iterator.h" 12 | #include "forward_list_const_iterator.h" 13 | 14 | #ifndef _MSC_VER 15 | #define NOEXCEPT noexcept 16 | #else 17 | #define NOEXCEPT 18 | #endif 19 | 20 | namespace my_library { 21 | 22 | template 23 | class forward_list { 24 | 25 | public: 26 | 27 | typedef forward_list_iterator<_Tp> iterator; 28 | typedef forward_list_const_iterator<_Tp> const_iterator; 29 | 30 | forward_list(); 31 | explicit forward_list(size_t, _Tp const&); 32 | forward_list(iterator, iterator); 33 | forward_list(const_iterator, const_iterator); 34 | forward_list(forward_list<_Tp> const&); 35 | forward_list(forward_list<_Tp>&&); 36 | ~forward_list(); 37 | 38 | auto assign(size_t, _Tp const&) -> void; 39 | auto assign(iterator, iterator) -> void; 40 | auto assign(const_iterator, const_iterator) -> void; 41 | auto before_begin() NOEXCEPT -> iterator; 42 | auto before_begin() const NOEXCEPT -> const_iterator; 43 | auto begin() NOEXCEPT -> iterator; 44 | auto begin() const NOEXCEPT -> const_iterator; 45 | auto cbefore_begin() NOEXCEPT -> const_iterator; 46 | auto cbegin() const NOEXCEPT -> const_iterator; 47 | auto cend() const NOEXCEPT -> const_iterator; 48 | auto clear() NOEXCEPT -> void; 49 | auto empty() const NOEXCEPT -> bool; 50 | auto end() NOEXCEPT ->iterator; 51 | auto end() const NOEXCEPT -> const_iterator; 52 | auto erase_after(const_iterator) -> iterator; 53 | auto erase_after(const_iterator, const_iterator) -> iterator; 54 | auto front() ->_Tp&; 55 | auto front() const ->_Tp const&; 56 | auto insert_after(const_iterator, _Tp const&) -> void; 57 | auto insert_after(const_iterator, _Tp&&) -> void; 58 | auto insert_after(const_iterator, size_t, _Tp const&) -> void; 59 | auto insert_after(const_iterator, iterator, iterator) -> void; 60 | auto insert_after(const_iterator, const_iterator, const_iterator) -> void; 61 | auto operator=(forward_list<_Tp> const&) -> forward_list<_Tp>&; 62 | auto operator=(forward_list<_Tp>&&) -> forward_list<_Tp>&; 63 | auto pop_front() -> void; 64 | auto push_front(_Tp const&) -> void; 65 | auto push_front(_Tp&&) -> void; 66 | auto reverse() NOEXCEPT -> void; 67 | auto swap(forward_list<_Tp>&) -> void; 68 | 69 | private: 70 | 71 | forward_list_node_base m_pHead; 72 | 73 | }; 74 | 75 | template 76 | forward_list<_Tp>::forward_list() { 77 | m_pHead.m_pNext = nullptr; 78 | } 79 | 80 | template 81 | forward_list<_Tp>::forward_list(size_t _num, _Tp const& _value) 82 | : m_pHead() { 83 | this->insert_after(this->cbefore_begin(), _num, _value); 84 | } 85 | 86 | template 87 | forward_list<_Tp>::forward_list(iterator _first, iterator _last) 88 | : m_pHead() { 89 | this->insert_after(this->cbefore_begin(), _first, _last); 90 | } 91 | 92 | template 93 | forward_list<_Tp>::forward_list(const_iterator _first, 94 | const_iterator _last) : m_pHead() { 95 | this->insert_after(this->cbefore_begin(), _first, _last); 96 | } 97 | 98 | template 99 | forward_list<_Tp>::forward_list(forward_list<_Tp> const& _forward_list) 100 | : m_pHead() { 101 | this->insert_after(this->cbefore_begin(), _forward_list.cbegin(), 102 | _forward_list.cend()); 103 | } 104 | 105 | template 106 | forward_list<_Tp>::forward_list(forward_list<_Tp>&& _forward_list) 107 | : m_pHead() { 108 | *this = std::move(_forward_list); 109 | _forward_list.m_pHead.m_pNext = nullptr; 110 | } 111 | 112 | template 113 | forward_list<_Tp>::~forward_list() { 114 | forward_list_node_base* _node = m_pHead.m_pNext; 115 | while (_node != nullptr) { 116 | forward_list_node_base* _temp = 117 | static_cast*>(_node); 118 | _node = _node->m_pNext; 119 | delete _temp; 120 | } 121 | } 122 | 123 | template 124 | auto forward_list<_Tp>::assign(size_t _num, _Tp const& _value) -> void { 125 | this->clear(); 126 | this->insert_after(this->cbefore_begin(), _num, _value); 127 | } 128 | 129 | template 130 | auto forward_list<_Tp>::assign(iterator _first, iterator _last) -> void { 131 | this->clear(); 132 | this->insert_after(this->cbefore_begin(), _first, _last); 133 | } 134 | 135 | template 136 | auto forward_list<_Tp>::assign(const_iterator _first, const_iterator _last) -> void { 137 | this->clear(); 138 | this->insert_after(this->cbefore_begin(), _first, _last); 139 | } 140 | 141 | template 142 | auto forward_list<_Tp>::before_begin() NOEXCEPT 143 | -> typename forward_list<_Tp>::iterator { 144 | return forward_list_iterator<_Tp>(&m_pHead); 145 | } 146 | 147 | template 148 | auto forward_list<_Tp>::before_begin() const NOEXCEPT 149 | -> typename forward_list<_Tp>::const_iterator { 150 | return forward_list_const_iterator<_Tp>(&m_pHead); 151 | } 152 | 153 | template 154 | auto forward_list<_Tp>::begin() NOEXCEPT 155 | -> typename forward_list<_Tp>::iterator { 156 | return forward_list_iterator<_Tp>(m_pHead.m_pNext); 157 | } 158 | 159 | template 160 | auto forward_list<_Tp>::begin() const NOEXCEPT 161 | -> typename forward_list<_Tp>::const_iterator { 162 | return forward_list_const_iterator<_Tp>(m_pHead.m_pNext); 163 | } 164 | 165 | template 166 | auto forward_list<_Tp>::cbefore_begin() NOEXCEPT 167 | -> typename forward_list<_Tp>::const_iterator { 168 | return forward_list_const_iterator<_Tp>(&m_pHead); 169 | } 170 | 171 | template 172 | auto forward_list<_Tp>::cbegin() const NOEXCEPT 173 | -> typename forward_list<_Tp>::const_iterator { 174 | return forward_list_const_iterator<_Tp>(m_pHead.m_pNext); 175 | } 176 | 177 | template 178 | auto forward_list<_Tp>::cend() const NOEXCEPT 179 | -> typename forward_list<_Tp>::const_iterator { 180 | return forward_list_const_iterator<_Tp>(nullptr); 181 | } 182 | 183 | template 184 | auto forward_list<_Tp>::clear() NOEXCEPT -> void { 185 | while (!this->empty()) 186 | this->pop_front(); 187 | } 188 | 189 | template 190 | auto forward_list<_Tp>::empty() const NOEXCEPT -> bool { 191 | return m_pHead.m_pNext == nullptr; 192 | } 193 | 194 | template 195 | auto forward_list<_Tp>::end() NOEXCEPT 196 | -> typename forward_list<_Tp>::iterator { 197 | return forward_list_iterator<_Tp>( 198 | static_cast(nullptr)); 199 | } 200 | 201 | template 202 | auto forward_list<_Tp>::end() const NOEXCEPT 203 | -> typename forward_list<_Tp>::const_iterator { 204 | return forward_list_const_iterator<_Tp>( 205 | static_cast(nullptr)); 206 | } 207 | 208 | template 209 | auto forward_list<_Tp>::erase_after(const_iterator _position) 210 | -> typename forward_list<_Tp>::iterator { 211 | forward_list_node<_Tp>* _temp = 212 | static_cast*>(_position.m_pNode->m_pNext); 213 | _position.m_pNode->m_pNext = _temp->m_pNext; 214 | delete _temp; 215 | return forward_list_iterator<_Tp>(_position.m_pNode->m_pNext); 216 | } 217 | 218 | template 219 | auto forward_list<_Tp>::erase_after(const_iterator _first, 220 | const_iterator _last) -> typename forward_list<_Tp>::iterator { 221 | forward_list_node<_Tp>* _node_first = 222 | static_cast*>(_first.m_pNode->m_pNext); 223 | forward_list_node<_Tp>* _node_last = 224 | static_cast*>(_last.m_pNode); 225 | while (_node_first != _node_last) { 226 | forward_list_node<_Tp>* _temp = 227 | static_cast*>(_first.m_pNode->m_pNext); 228 | _first.m_pNode->m_pNext = _temp->m_pNext; 229 | delete _temp; 230 | _node_first = 231 | static_cast*>(_first.m_pNode->m_pNext); 232 | } 233 | return forward_list_iterator<_Tp>(_first.m_pNode->m_pNext); 234 | } 235 | 236 | template 237 | auto forward_list<_Tp>::front() -> _Tp& { 238 | return static_cast*>(m_pHead.m_pNext)->m_Value; 239 | } 240 | 241 | template 242 | auto forward_list<_Tp>::front() const -> _Tp const& { 243 | return static_cast*>(m_pHead.m_pNext)->m_Value; 244 | } 245 | 246 | template 247 | auto forward_list<_Tp>::insert_after(const_iterator _position, 248 | _Tp const& _value) -> void { 249 | forward_list_node<_Tp>* _node = new forward_list_node<_Tp>(_value); 250 | _node->m_pNext = _position.m_pNode->m_pNext; 251 | _position.m_pNode->m_pNext = _node; 252 | } 253 | 254 | template 255 | auto forward_list<_Tp>::insert_after(const_iterator _position, 256 | _Tp&& _value) -> void { 257 | forward_list_node<_Tp>* _node = 258 | new forward_list_node<_Tp>(std::move(_value)); 259 | _node->m_pNext = _position.m_pNode->m_pNext; 260 | _position.m_pNode->m_pNext = _node; 261 | } 262 | 263 | template 264 | auto forward_list<_Tp>::insert_after(const_iterator _position, size_t _num, 265 | _Tp const& _value) -> void { 266 | for (size_t i = 0; i < _num; ++i) 267 | this->insert_after(_position, _value); 268 | } 269 | 270 | template 271 | auto forward_list<_Tp>::insert_after(const_iterator _position, 272 | iterator _first, iterator _last) -> void { 273 | for (; _first != _last; ++_position, ++_first) { 274 | this->insert_after(_position, 275 | static_cast*>(_first.m_pNode)->m_Value); 276 | } 277 | } 278 | 279 | template 280 | auto forward_list<_Tp>::insert_after(const_iterator _position, 281 | const_iterator _first, const_iterator _last) -> void { 282 | for (; _first != _last; ++_position, ++_first) { 283 | this->insert_after(_position, 284 | static_cast*>(_first.m_pNode)->m_Value); 285 | } 286 | } 287 | 288 | template 289 | auto forward_list<_Tp>::operator=( 290 | forward_list<_Tp> const& _forward_list) -> forward_list<_Tp>& { 291 | if (this != &_forward_list) { 292 | forward_list<_Tp> _temp(_forward_list); 293 | this->swap(_temp); 294 | } 295 | return *this; 296 | } 297 | 298 | template 299 | auto forward_list<_Tp>::operator=( 300 | forward_list<_Tp>&& _forward_list) -> forward_list<_Tp>& { 301 | if (this != &_forward_list) { 302 | m_pHead.m_pNext = std::move(_forward_list.m_pHead).m_pNext; 303 | _forward_list.m_pHead.m_pNext = nullptr; 304 | } 305 | return *this; 306 | } 307 | 308 | template 309 | auto forward_list<_Tp>::pop_front() -> void { 310 | m_pHead.m_pNext = m_pHead.m_pNext->m_pNext; 311 | } 312 | 313 | template 314 | auto forward_list<_Tp>::push_front(_Tp const& _value) -> void { 315 | forward_list_node<_Tp>* _node = new forward_list_node<_Tp>(_value); 316 | _node->m_pNext = m_pHead.m_pNext; 317 | m_pHead.m_pNext = _node; 318 | } 319 | 320 | template 321 | auto forward_list<_Tp>::push_front(_Tp&& _value) -> void { 322 | forward_list_node<_Tp>* _node = 323 | new forward_list_node<_Tp>(std::move(_value)); 324 | _node->m_pNext = m_pHead.m_pNext; 325 | m_pHead.m_pNext = _node; 326 | } 327 | 328 | template 329 | auto forward_list<_Tp>::reverse() NOEXCEPT -> void { 330 | forward_list_node_base* _tail = m_pHead.m_pNext; 331 | if (!_tail) 332 | return; 333 | while (forward_list_node_base* _temp = _tail->m_pNext) { 334 | forward_list_node_base* _keep = m_pHead.m_pNext; 335 | m_pHead.m_pNext = _temp; 336 | _tail->m_pNext = _temp->m_pNext; 337 | m_pHead.m_pNext->m_pNext = _keep; 338 | } 339 | } 340 | 341 | template 342 | auto forward_list<_Tp>::swap(forward_list<_Tp>& _forward_list) -> void { 343 | std::swap(this->m_pHead.m_pNext, _forward_list.m_pHead.m_pNext); 344 | } 345 | 346 | } 347 | -------------------------------------------------------------------------------- /MyLibrary/Forward List/forward_list_const_iterator.h: -------------------------------------------------------------------------------- 1 | /** 2 | * forward_list_const_iterator.h 3 | * 4 | * @author Raul Butuc 5 | */ 6 | 7 | #pragma once 8 | 9 | #include "forward_list.h" 10 | #include "forward_list_node.h" 11 | 12 | namespace my_library { 13 | 14 | template class forward_list; 15 | template class forward_list_node; 16 | 17 | template 18 | class forward_list_const_iterator { 19 | 20 | friend class forward_list<_Tp>; 21 | 22 | public: 23 | 24 | typedef forward_list_const_iterator<_Tp> const_iterator; 25 | typedef size_t size_type; 26 | typedef _Tp value_type; 27 | typedef _Tp& reference; 28 | typedef _Tp* pointer; 29 | typedef std::forward_iterator_tag iterator_category; 30 | typedef size_t difference_type; 31 | 32 | auto operator++() -> const_iterator const&; 33 | auto operator++(int) -> const_iterator const&; 34 | auto operator+=(int) -> const_iterator const&; 35 | auto operator*() const -> reference; 36 | auto operator->() const -> pointer; 37 | auto operator==(const_iterator const&) const -> bool; 38 | auto operator!=(const_iterator const&) const -> bool; 39 | 40 | private: 41 | 42 | forward_list_node_base* m_pNode; 43 | 44 | forward_list_const_iterator(forward_list_node_base*); 45 | 46 | }; 47 | 48 | template 49 | forward_list_const_iterator<_Tp>::forward_list_const_iterator( 50 | forward_list_node_base* _node) 51 | : m_pNode(_node) {} 52 | 53 | template 54 | auto forward_list_const_iterator<_Tp>::operator++() 55 | -> typename forward_list_const_iterator<_Tp>::const_iterator const& { 56 | if (m_pNode == nullptr) return static_cast(nullptr); 57 | m_pNode = m_pNode->m_pNext; 58 | return *this; 59 | } 60 | 61 | template 62 | auto forward_list_const_iterator<_Tp>::operator++(int) 63 | -> typename forward_list_const_iterator<_Tp>::const_iterator const& { 64 | forward_list_const_iterator<_Tp> _temp(*this); 65 | ++(*this); 66 | return _temp; 67 | } 68 | 69 | template 70 | auto forward_list_const_iterator<_Tp>::operator+=(int _num) 71 | -> typename forward_list_const_iterator<_Tp>::const_iterator const& { 72 | for (int i = 0; i < _num; ++i, ++(*this)); 73 | return *this; 74 | } 75 | 76 | template 77 | auto forward_list_const_iterator<_Tp>::operator*() const 78 | -> typename forward_list_const_iterator<_Tp>::reference { 79 | return static_cast*>(m_pNode)->m_Value; 80 | } 81 | 82 | template 83 | auto forward_list_const_iterator<_Tp>::operator->() const 84 | -> typename forward_list_const_iterator<_Tp>::pointer { 85 | return static_cast*>(m_pNode); 86 | } 87 | 88 | template 89 | auto forward_list_const_iterator<_Tp>::operator==( 90 | const_iterator const& _position) const -> bool { 91 | return m_pNode == _position.m_pNode; 92 | } 93 | 94 | template 95 | auto forward_list_const_iterator<_Tp>::operator!=( 96 | const_iterator const& _position) const -> bool { 97 | return m_pNode != _position.m_pNode; 98 | } 99 | 100 | } 101 | -------------------------------------------------------------------------------- /MyLibrary/Forward List/forward_list_iterator.h: -------------------------------------------------------------------------------- 1 | /** 2 | * forward_list_iterator.h 3 | * 4 | * @author Raul Butuc 5 | */ 6 | 7 | #pragma once 8 | 9 | #include "forward_list.h" 10 | #include "forward_list_node.h" 11 | 12 | namespace my_library { 13 | 14 | template class forward_list; 15 | template class forward_list_node; 16 | 17 | template 18 | class forward_list_iterator { 19 | 20 | friend class forward_list<_Tp>; 21 | 22 | public: 23 | 24 | typedef forward_list_iterator<_Tp> iterator; 25 | typedef size_t size_type; 26 | typedef _Tp value_type; 27 | typedef _Tp& reference; 28 | typedef _Tp* pointer; 29 | typedef std::forward_iterator_tag iterator_category; 30 | typedef size_t difference_type; 31 | 32 | auto operator++() -> iterator const&; 33 | auto operator++(int) -> iterator const&; 34 | auto operator+=(int) -> iterator const&; 35 | auto operator*() const -> reference; 36 | auto operator->() const -> pointer; 37 | auto operator==(iterator const&) const -> bool; 38 | auto operator!=(iterator const&) const -> bool; 39 | 40 | private: 41 | 42 | forward_list_node_base* m_pNode; 43 | 44 | forward_list_iterator(forward_list_node_base*); 45 | 46 | }; 47 | 48 | template 49 | forward_list_iterator<_Tp>::forward_list_iterator( 50 | forward_list_node_base* _node) 51 | : m_pNode(_node) {} 52 | 53 | template 54 | auto forward_list_iterator<_Tp>::operator++() 55 | -> typename forward_list_iterator<_Tp>::iterator const& { 56 | if (m_pNode == nullptr) return static_cast(nullptr); 57 | m_pNode = m_pNode->m_pNext; 58 | return *this; 59 | } 60 | 61 | template 62 | auto forward_list_iterator<_Tp>::operator++(int) 63 | -> typename forward_list_iterator<_Tp>::iterator const& { 64 | forward_list_iterator<_Tp> _temp(*this); 65 | ++(*this); 66 | return _temp; 67 | } 68 | 69 | template 70 | auto forward_list_iterator<_Tp>::operator+=(int _num) 71 | -> typename forward_list_iterator<_Tp>::iterator const& { 72 | for (int i = 0; i < _num; ++i, ++(*this)); 73 | return *this; 74 | } 75 | 76 | template 77 | auto forward_list_iterator<_Tp>::operator*() const 78 | -> typename forward_list_iterator<_Tp>::reference { 79 | return static_cast*>(m_pNode)->m_Value; 80 | } 81 | 82 | template 83 | auto forward_list_iterator<_Tp>::operator->() const 84 | -> typename forward_list_iterator<_Tp>::pointer { 85 | return static_cast*>(m_pNode); 86 | } 87 | 88 | template 89 | auto forward_list_iterator<_Tp>::operator==( 90 | const iterator& _position) const -> bool { 91 | return m_pNode == _position.m_pNode; 92 | } 93 | 94 | template 95 | auto forward_list_iterator<_Tp>::operator!=( 96 | const iterator& _position) const -> bool { 97 | return m_pNode != _position.m_pNode; 98 | } 99 | 100 | } 101 | -------------------------------------------------------------------------------- /MyLibrary/Forward List/forward_list_node.h: -------------------------------------------------------------------------------- 1 | /** 2 | * forward_list_node.h 3 | * 4 | * @author Raul Butuc 5 | */ 6 | 7 | #pragma once 8 | 9 | #include "forward_list_node_base.h" 10 | #include "forward_list.h" 11 | #include "forward_list_iterator.h" 12 | #include "forward_list_const_iterator.h" 13 | 14 | namespace my_library { 15 | 16 | template 17 | class forward_list_node : public forward_list_node_base { 18 | 19 | friend class forward_list<_Tp>; 20 | friend class forward_list_iterator<_Tp>; 21 | friend class forward_list_const_iterator<_Tp>; 22 | 23 | private: 24 | 25 | _Tp m_Value; 26 | 27 | forward_list_node(_Tp const&); 28 | 29 | }; 30 | 31 | template 32 | forward_list_node<_Tp>::forward_list_node(_Tp const& _value) 33 | : m_Value(_value), forward_list_node_base() {} 34 | 35 | } 36 | -------------------------------------------------------------------------------- /MyLibrary/Forward List/forward_list_node_base.h: -------------------------------------------------------------------------------- 1 | /** 2 | * forward_list_node_base.h 3 | * 4 | * @author Raul Butuc 5 | */ 6 | 7 | #pragma once 8 | 9 | namespace my_library { 10 | 11 | class forward_list_node_base { 12 | 13 | public: 14 | 15 | forward_list_node_base* m_pNext; 16 | 17 | forward_list_node_base(); 18 | 19 | }; 20 | 21 | forward_list_node_base::forward_list_node_base() 22 | : m_pNext(nullptr) {} 23 | 24 | } 25 | -------------------------------------------------------------------------------- /MyLibrary/Graph/Graph.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | Debug 14 | x64 15 | 16 | 17 | Release 18 | x64 19 | 20 | 21 | 22 | {73AB4480-2264-4736-91C8-8DE6F0BBC1D2} 23 | Win32Proj 24 | Graph 25 | 10.0.14393.0 26 | 27 | 28 | 29 | Application 30 | true 31 | v141 32 | Unicode 33 | 34 | 35 | Application 36 | false 37 | v141 38 | true 39 | Unicode 40 | 41 | 42 | Application 43 | true 44 | v141 45 | Unicode 46 | 47 | 48 | Application 49 | false 50 | v141 51 | true 52 | Unicode 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | true 74 | D:\Programming\Personal\Projects\MyLibrary\MyLibrary\Forward List;D:\Programming\Personal\Projects\MyLibrary\MyLibrary\Unit Test;$(IncludePath) 75 | 76 | 77 | true 78 | 79 | 80 | false 81 | 82 | 83 | false 84 | 85 | 86 | 87 | 88 | 89 | Level3 90 | Disabled 91 | WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) 92 | true 93 | 94 | 95 | Console 96 | true 97 | 98 | 99 | 100 | 101 | 102 | 103 | Level3 104 | Disabled 105 | _DEBUG;_CONSOLE;%(PreprocessorDefinitions) 106 | true 107 | 108 | 109 | Console 110 | true 111 | 112 | 113 | 114 | 115 | Level3 116 | 117 | 118 | MaxSpeed 119 | true 120 | true 121 | WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 122 | true 123 | 124 | 125 | Console 126 | true 127 | true 128 | true 129 | 130 | 131 | 132 | 133 | Level3 134 | 135 | 136 | MaxSpeed 137 | true 138 | true 139 | NDEBUG;_CONSOLE;%(PreprocessorDefinitions) 140 | true 141 | 142 | 143 | Console 144 | true 145 | true 146 | true 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | -------------------------------------------------------------------------------- /MyLibrary/Graph/Graph.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | 29 | 30 | Source Files 31 | 32 | 33 | -------------------------------------------------------------------------------- /MyLibrary/Graph/graph.h: -------------------------------------------------------------------------------- 1 | /** 2 | * graph.h 3 | * 4 | * @author Raul Butuc 5 | */ 6 | 7 | #pragma once 8 | 9 | #include "forward_list.h" 10 | #include "graph_node.h" 11 | #include "graph_type.h" 12 | #include 13 | 14 | #ifndef _MSC_VER 15 | #define NOEXCEPT noexcept 16 | #else 17 | #define NOEXCEPT 18 | #endif 19 | 20 | namespace my_library { 21 | 22 | template 23 | class graph { 24 | 25 | public: 26 | 27 | graph(); 28 | graph(GRAPH_TYPE); 29 | graph(GRAPH_TYPE, bool); 30 | graph(GRAPH_TYPE, double); 31 | graph(GRAPH_TYPE, bool, double); 32 | auto addNode(_Tp const&) -> void; 33 | auto addNode(graph_node<_Tp> const&) -> void; 34 | auto addNodes(std::vector<_Tp> const&) -> void; 35 | auto addNodes(std::vector> const&) -> void; 36 | auto getType() const -> GRAPH_TYPE; 37 | auto setType(GRAPH_TYPE const&) -> void; 38 | auto isWeighted() const -> bool; 39 | auto setWeighted(bool const&) -> void; 40 | auto getNrNodes() const -> int; 41 | auto getNrEdges() const -> int; 42 | auto getNodeInnerDegree(graph_node<_Tp> const&) const -> int; 43 | auto getNodeOuterDegree(graph_node<_Tp> const&) const -> int; 44 | auto getNodeDegree(graph_node<_Tp> const&) const-> int; 45 | auto isComplete() const -> bool; 46 | auto isSimple() const -> bool; 47 | auto isMultigraph() const -> bool; 48 | auto isQuiver() const -> bool; 49 | auto isConnected() const -> bool; 50 | auto isStronglyConnected() const -> bool; 51 | auto isSparse() const -> bool; 52 | auto isDense() const -> bool; 53 | auto isPath() const -> bool; 54 | auto isPlanar() const -> bool; 55 | auto isCycle() const -> bool; 56 | auto isInterval() const -> bool; 57 | auto isBipartite() const -> bool; 58 | auto isHamiltonian() const -> bool; 59 | auto isEulerian() const -> bool; 60 | auto shortestPath(graph_node<_Tp>, graph_node<_Tp>) -> list>; 61 | ~graph(); 62 | 63 | private: 64 | 65 | GRAPH_TYPE type; 66 | bool weighted; 67 | double densityThreshold; 68 | std::vector> nodes; 69 | 70 | auto computeDensity() const -> double; 71 | 72 | }; 73 | 74 | template 75 | graph<_Tp>::graph() : type(GRAPH_TYPE.Undirected), weighted(false), densityThreshold(0.5) { } 76 | 77 | template 78 | graph<_Tp>::graph(GRAPH_TYPE _type) : type(_type), weighted(false), densityThreshold(0.5) { } 79 | 80 | template 81 | graph<_Tp>::graph(GRAPH_TYPE _type, bool _weighted) : type(_type), weighted(_weighted), 82 | densityThreshold(0.5) { } 83 | 84 | template 85 | graph<_Tp>::graph(GRAPH_TYPE _type, double _densityThreshold) : type(_type), weighted(false), 86 | densityThreshold(_densityThreshold) { } 87 | 88 | template 89 | graph<_Tp>::graph(GRAPH_TYPE _type, bool _weighted, double _densityThreshold) : type(_type), 90 | weighted(_weighted), densityThreshold(_densityThreshold) { } 91 | 92 | template 93 | auto graph<_Tp>::addNode(_Tp const& _value) -> void { 94 | graph_node<_Tp> node(_value); 95 | nodes.push_back(node); 96 | } 97 | 98 | template 99 | auto graph<_Tp>::addNode(graph_node<_Tp> const& _node) -> void { 100 | nodes.push_back(_node); 101 | } 102 | 103 | template 104 | auto graph<_Tp>::addNodes(std::vector<_Tp> const& _values) -> void { 105 | for (auto value : _values) { 106 | graph_node<_Tp> node(value); 107 | nodes.push_back(node); 108 | } 109 | } 110 | 111 | template 112 | auto graph<_Tp>::addNodes(std::vector> const& _nodes) -> void { 113 | for (auto node : _nodes) { 114 | nodes.push_back(node); 115 | } 116 | } 117 | 118 | template 119 | auto graph<_Tp>::getType() const -> GRAPH_TYPE { 120 | return type; 121 | } 122 | 123 | template 124 | auto graph<_Tp>::setType(GRAPH_TYPE const& _type) -> void { 125 | type = _type; 126 | } 127 | 128 | template 129 | auto graph<_Tp>::isWeighted() const -> bool { 130 | return weighted; 131 | } 132 | 133 | template 134 | auto graph<_Tp>::setWeighted(bool const& _weighted) -> void { 135 | weighted = _weighted; 136 | } 137 | 138 | template 139 | auto my_library::graph<_Tp>::getNrNodes() const -> int { 140 | return nodes.size(); 141 | } 142 | 143 | template 144 | auto my_library::graph<_Tp>::getNrEdges() const -> int { 145 | for (auto node : nodes) { 146 | auto neighbours = node.getNeighbours(); 147 | return neighbours.size(); 148 | } 149 | } 150 | 151 | template 152 | auto graph<_Tp>::getNodeInnerDegree(graph_node<_Tp> const& _node) const -> int { 153 | if (type == GRAPH_TYPE::Directed) { 154 | return 0; // The inner degree 155 | } 156 | 157 | return getNodeDegree(_node); 158 | } 159 | 160 | template 161 | auto graph<_Tp>::getNodeOuterDegree(graph_node<_Tp> const& _node) const -> int { 162 | if (type == GRAPH_TYPE::Directed) { 163 | return 0; // The outer degree 164 | } 165 | 166 | return getNodeDegree(_node); 167 | } 168 | 169 | template 170 | auto graph<_Tp>::getNodeDegree(graph_node<_Tp> const& _node) const -> int { 171 | if (type == GRAPH_TYPE::Undirected) { 172 | return _node.getNeighbours().size(); 173 | } 174 | 175 | return -1; 176 | } 177 | 178 | template 179 | inline auto graph<_Tp>::isComplete() const -> bool 180 | { 181 | return false; 182 | } 183 | 184 | template 185 | inline auto graph<_Tp>::isSimple() const -> bool 186 | { 187 | return false; 188 | } 189 | 190 | template 191 | inline auto graph<_Tp>::isMultigraph() const -> bool 192 | { 193 | return false; 194 | } 195 | 196 | template 197 | inline auto graph<_Tp>::isQuiver() const -> bool 198 | { 199 | return false; 200 | } 201 | 202 | template 203 | inline auto graph<_Tp>::isConnected() const -> bool 204 | { 205 | return false; 206 | } 207 | 208 | template 209 | inline auto graph<_Tp>::isStronglyConnected() const -> bool 210 | { 211 | return false; 212 | } 213 | 214 | template 215 | auto graph<_Tp>::isSparse() const -> bool { 216 | double density = computeDensity(); 217 | if (density < densityThreshold) { 218 | return true; 219 | } 220 | else { 221 | return false; 222 | } 223 | } 224 | 225 | template 226 | auto graph<_Tp>::isDense() const -> bool { 227 | return !isSparse(); 228 | } 229 | 230 | template 231 | inline auto graph<_Tp>::isPath() const -> bool 232 | { 233 | return false; 234 | } 235 | 236 | template 237 | inline auto graph<_Tp>::isPlanar() const -> bool 238 | { 239 | return false; 240 | } 241 | 242 | template 243 | inline auto graph<_Tp>::isCycle() const -> bool 244 | { 245 | return false; 246 | } 247 | 248 | template 249 | inline auto graph<_Tp>::isInterval() const -> bool 250 | { 251 | return false; 252 | } 253 | 254 | template 255 | inline auto graph<_Tp>::isBipartite() const -> bool 256 | { 257 | return false; 258 | } 259 | 260 | template 261 | auto graph<_Tp>::isHamiltonian() const -> bool { 262 | // @TODO: Complete the Hamiltonian graph checks (each vertex may be visited only once). 263 | } 264 | 265 | template 266 | auto graph<_Tp>::isEulerian() const -> bool { 267 | // @TODO: Complete the Eulerian graph checks (each edge may be visited only once). 268 | } 269 | 270 | template 271 | auto graph<_Tp>::shortestPath(graph_node start, graph_node end) -> list { 272 | // @TODO: Implement Dijkstra, Bellman-Ford and Roy-Floyd-Warshall algorithms. 273 | } 274 | 275 | template 276 | graph<_Tp>::~graph() { } 277 | 278 | template 279 | auto graph<_Tp>::computeDensity() const -> double { 280 | int edges = getNrEdges(); 281 | int nodes = getNrNodes(); 282 | 283 | switch (this.type) { 284 | case GRAPH_TYPE::Undirected: 285 | return (2 * edges) / (nodes * (nodes - 1)); 286 | break; 287 | 288 | case GRAPH_TYPE::Directed: 289 | return edges / (nodes * (nodes - 1)); 290 | break; 291 | 292 | default: 293 | break; 294 | } 295 | 296 | return -1; 297 | } 298 | 299 | } 300 | -------------------------------------------------------------------------------- /MyLibrary/Graph/graph_node.h: -------------------------------------------------------------------------------- 1 | /** 2 | * graph_node.h 3 | * 4 | * @author Raul Butuc 5 | */ 6 | 7 | #pragma once 8 | 9 | #include "forward_list.h" 10 | 11 | #ifndef _MSC_VER 12 | #define NOEXCEPT noexcept 13 | #else 14 | #define NOEXCEPT 15 | #endif 16 | 17 | namespace my_library { 18 | 19 | template 20 | class graph_node { 21 | 22 | public: 23 | 24 | graph_node(); 25 | graph_node(_Tp const&); 26 | graph_node(graph_node<_Tp> const&); 27 | graph_node(_Tp const&, forward_list<_Tp> const&); 28 | graph_node(graph_node<_Tp> const&, forward_list<_Tp> const&); 29 | graph_node(_Tp const&, forward_list> const&); 30 | graph_node(graph_node<_Tp> const&, forward_list> const&); 31 | auto setValue(_Tp const&) -> void; 32 | auto getValue() const -> _Tp; 33 | auto addNeighbour(_Tp const&) -> void; 34 | auto addNeighbour(graph_node<_Tp> const&) -> void; 35 | auto addNeighbours(forward_list<_Tp> const&) -> void; 36 | auto addNeighbours(forward_list> const&) -> void; 37 | auto removeNeighbour(_Tp const&) -> void; 38 | auto removeNeighbour(graph_node<_Tp> const&) -> void; 39 | auto removeNeighbours(forward_list<_Tp> const&) -> void; 40 | auto removeNeighbours(forward_list> const&) -> void; 41 | auto removeAllNeighbours() -> void; 42 | auto getNeighbours() -> forward_list>; 43 | 44 | private: 45 | 46 | _Tp value; 47 | forward_list> neighbours; 48 | 49 | }; 50 | 51 | template 52 | graph_node<_Tp>::graph_node() { } 53 | 54 | template 55 | graph_node<_Tp>::graph_node(_Tp const& _value) : value(_value) { } 56 | 57 | template 58 | graph_node<_Tp>::graph_node(graph_node<_Tp> const& _node) : value(_node.getValue()) { } 59 | 60 | template 61 | graph_node<_Tp>::graph_node(_Tp const& _value, 62 | forward_list<_Tp> const& _neighbours) : value(_value) { 63 | for (auto it = _neighbours.begin(); it != _neighbours.end(); ++it) { 64 | graph_node<_Tp> newNeighbour = graph_node<_Tp>(*it); 65 | neighbours.push_back(newNeighbour); 66 | } 67 | } 68 | 69 | template 70 | graph_node<_Tp>::graph_node(graph_node<_Tp> const& _node, 71 | forward_list<_Tp> const& _neighbours) : value(_node.getValue()) { 72 | for (auto it = _neighbours.begin(); it != _neighbours.end(); ++it) { 73 | graph_node<_Tp> newNeighbour = graph_node<_Tp>(*it); 74 | neighbours.push_back(newNeighbour); 75 | } 76 | } 77 | 78 | template 79 | graph_node<_Tp>::graph_node(_Tp const& _value, 80 | forward_list> const& _neighbours) : value(_value) { 81 | for (auto it = _neighbours.begin(); it != _neighbours.end(); ++it) { 82 | graph_node<_Tp> newNeighbour = graph_node<_Tp>(*it); 83 | neighbours.push_back(newNeighbour); 84 | } 85 | } 86 | 87 | template 88 | graph_node<_Tp>::graph_node(graph_node<_Tp> const& _node, 89 | forward_list> const& _neighbours) : value(_node.getValue()) { 90 | for (auto it = _neighbours.begin(); it != _neighbours.end(); ++it) { 91 | graph_node<_Tp> newNeighbour = graph_node<_Tp>(*it); 92 | neighbours.push_back(newNeighbour); 93 | } 94 | } 95 | 96 | template 97 | auto graph_node<_Tp>::setValue(_Tp const& _value) -> void { 98 | value = _value; 99 | } 100 | 101 | template 102 | auto graph_node<_Tp>::getValue() const -> _Tp { 103 | return value; 104 | } 105 | 106 | template 107 | auto graph_node<_Tp>::addNeighbour(_Tp const& _value) -> void { 108 | graph_node<_Tp> newNeighbour = graph_node<_Tp>(_value); 109 | neighbours.push_back(newNeighbour); 110 | } 111 | 112 | template 113 | auto graph_node<_Tp>::addNeighbour(graph_node<_Tp> const& _node) -> void { 114 | neighbours.push_back(_node); 115 | } 116 | 117 | template 118 | auto graph_node<_Tp>::addNeighbours(forward_list<_Tp> const& _neighbours) 119 | -> void { 120 | for (auto it = _neighbours.begin(); it != _neighbours.end(); ++it) { 121 | graph_node<_Tp> newNeighbour = graph_node<_Tp>(*it); 122 | neighbours.push_back(newNeighbour); 123 | } 124 | } 125 | 126 | template 127 | auto graph_node<_Tp>::addNeighbours(forward_list> const& _neighbours) 128 | -> void { 129 | for (auto it = _neighbours.begin(); it != _neighbours.end(); ++it) { 130 | graph_node<_Tp> newNeighbour = graph_node<_Tp>(*it); 131 | neighbours.push_back(newNeighbour); 132 | } 133 | } 134 | 135 | template 136 | auto graph_node<_Tp>::removeNeighbour(_Tp const& _value) -> void { 137 | neighbours.remove(graph_node<_Tp>(_value)); 138 | } 139 | 140 | template 141 | auto graph_node<_Tp>::removeNeighbour(graph_node<_Tp> const& _node) -> void { 142 | neighbours.remove(_node); 143 | } 144 | 145 | template 146 | auto graph_node<_Tp>::removeNeighbours(forward_list<_Tp> const& _neighbours) 147 | -> void { 148 | for (auto it = _neighbours.begin(); it != _neighbours.end(); ++it) { 149 | neighbours.remove(graph_node<_Tp>(*it)); 150 | } 151 | } 152 | 153 | template 154 | auto graph_node<_Tp>::removeNeighbours(forward_list> const& _neighbours) 155 | -> void { 156 | for (auto it = _neighbours.begin(); it != _neighbours.end(); ++it) -> void { 157 | neighbours.remove(*it); 158 | } 159 | } 160 | 161 | template 162 | auto graph_node<_Tp>::removeAllNeighbours() -> void { 163 | neighbours.clear(); 164 | } 165 | 166 | template 167 | auto graph_node<_Tp>::getNeighbours() -> forward_list> { 168 | return neighbours; 169 | } 170 | 171 | } 172 | -------------------------------------------------------------------------------- /MyLibrary/Graph/graph_type.h: -------------------------------------------------------------------------------- 1 | /** 2 | * graph_type.h 3 | * 4 | * @author Raul Butuc 5 | */ 6 | 7 | enum GRAPH_TYPE { 8 | Undirected = 0, Directed 9 | }; 10 | -------------------------------------------------------------------------------- /MyLibrary/List/List.vcxproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | Win32 7 | 8 | 9 | Release 10 | Win32 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | {4C8CB3C8-3289-4472-A842-F942DE01A3D1} 22 | Win32Proj 23 | List 24 | 10.0.14393.0 25 | 26 | 27 | 28 | Application 29 | true 30 | v141 31 | Unicode 32 | 33 | 34 | Application 35 | false 36 | v141 37 | true 38 | Unicode 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | true 52 | 53 | 54 | false 55 | 56 | 57 | 58 | 59 | 60 | Level3 61 | Disabled 62 | WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) 63 | true 64 | 65 | 66 | Console 67 | true 68 | D:\Programming\Git\MyLibrary\MyLibrary\Debug\UnitTest.lib;%(AdditionalDependencies) 69 | 70 | 71 | 72 | 73 | Level3 74 | 75 | 76 | MaxSpeed 77 | true 78 | true 79 | WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) 80 | true 81 | 82 | 83 | Console 84 | true 85 | true 86 | true 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /MyLibrary/List/List.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hh;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Header Files 20 | 21 | 22 | Header Files 23 | 24 | 25 | Header Files 26 | 27 | 28 | Header Files 29 | 30 | 31 | Header Files 32 | 33 | 34 | -------------------------------------------------------------------------------- /MyLibrary/List/list.h: -------------------------------------------------------------------------------- 1 | /** 2 | * list.h 3 | * 4 | * @author Raul Butuc 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | #include "list_node.h" 11 | #include "list_iterator.h" 12 | #include "list_const_iterator.h" 13 | 14 | #ifndef _MSC_VER 15 | #define NOEXCEPT noexcept 16 | #else 17 | #define NOEXCEPT 18 | #endif 19 | 20 | namespace my_library { 21 | 22 | template 23 | class list { 24 | 25 | public: 26 | 27 | typedef list_iterator<_Tp> iterator; 28 | typedef list_const_iterator<_Tp> const_iterator; 29 | 30 | list(); 31 | explicit list(size_t, _Tp const&); 32 | list(iterator, iterator); 33 | list(const_iterator, const_iterator); 34 | list(list<_Tp> const&); 35 | list(list<_Tp>&&); 36 | ~list(); 37 | 38 | auto assign(size_t, _Tp const&) -> void; 39 | auto assign(iterator, iterator) -> void; 40 | auto assign(const_iterator, const_iterator) -> void; 41 | auto back() -> _Tp&; 42 | auto back() const -> _Tp const&; 43 | auto before_begin() NOEXCEPT -> iterator; 44 | auto before_begin() const NOEXCEPT -> const_iterator; 45 | auto before_end() NOEXCEPT -> iterator; 46 | auto before_end() const NOEXCEPT -> const_iterator; 47 | auto begin() NOEXCEPT -> iterator; 48 | auto begin() const NOEXCEPT -> const_iterator; 49 | auto cbefore_begin() NOEXCEPT -> const_iterator; 50 | auto cbegin() const NOEXCEPT -> const_iterator; 51 | auto cend() const NOEXCEPT -> const_iterator; 52 | auto clear() NOEXCEPT -> void; 53 | auto empty() const NOEXCEPT -> bool; 54 | auto end() NOEXCEPT -> iterator; 55 | auto end() const NOEXCEPT -> const_iterator; 56 | auto erase_after(const_iterator) -> iterator; 57 | auto erase_after(const_iterator, const_iterator) -> iterator; 58 | auto erase_before(const_iterator) -> iterator; 59 | auto erase_before(const_iterator, const_iterator) -> iterator; 60 | auto front() -> _Tp&; 61 | auto const& front() const -> _Tp; 62 | auto insert_after(const_iterator, _Tp const&) -> void; 63 | auto insert_after(const_iterator, _Tp&&) -> void; 64 | auto insert_after(const_iterator, size_t, _Tp const&) -> void; 65 | auto insert_after(const_iterator, iterator, iterator) -> void; 66 | auto insert_after(const_iterator, const_iterator, const_iterator) -> void; 67 | auto insert_before(const_iterator, _Tp const&) -> void; 68 | auto insert_before(const_iterator, _Tp&&) -> void; 69 | auto insert_before(const_iterator, size_t, _Tp const&) -> void; 70 | auto insert_before(const_iterator, iterator, iterator) -> void; 71 | auto insert_before(const_iterator, const_iterator, const_iterator) -> void; 72 | auto operator=(list<_Tp> const&) -> list<_Tp>&; 73 | auto operator=(list<_Tp>&&) -> list<_Tp>&; 74 | auto pop_back() -> void; 75 | auto pop_front() -> void; 76 | auto push_back(_Tp const&) -> void; 77 | auto push_back(_Tp&&) -> void; 78 | auto push_front(_Tp const&) -> void; 79 | auto push_front(_Tp&&) -> void; 80 | auto remove(_Tp const&) -> void; 81 | auto reverse() NOEXCEPT -> void; 82 | auto swap(list<_Tp>&) -> void; 83 | 84 | private: 85 | 86 | list_node_base m_pHead, m_pTail; 87 | }; 88 | 89 | template 90 | list<_Tp>::list() { 91 | m_pHead.m_pNext = nullptr; 92 | m_pTail.m_pPrev = nullptr; 93 | } 94 | 95 | template 96 | list<_Tp>::list(size_t _num, _Tp const& _value) 97 | : m_pHead(), m_pTail() { 98 | this->insert_after(this->cbefore_begin(), _num, _value); 99 | } 100 | 101 | template 102 | list<_Tp>::list(iterator _first, iterator _last) 103 | : m_pHead(), m_pTail() { 104 | this->insert_after(this->cbefore_begin(), _first, _last); 105 | } 106 | 107 | template 108 | list<_Tp>::list(const_iterator _first, 109 | const_iterator _last) : m_pHead(), m_pTail() { 110 | this->insert_after(this->cbefore_begin(), _first, _last); 111 | } 112 | 113 | template 114 | list<_Tp>::list(list<_Tp> const& _list) 115 | : m_pHead(), m_pTail() { 116 | this->insert_after(this->cbefore_begin(), _list.cbegin(), 117 | _list.cend()); 118 | } 119 | 120 | template 121 | list<_Tp>::list(list<_Tp>&& _list) 122 | : m_pHead(), m_pTail() { 123 | *this = std::move(_list); 124 | _list.m_pHead.m_pNext = nullptr; 125 | } 126 | 127 | template 128 | list<_Tp>::~list() { 129 | list_node_base* _node = m_pHead.m_pNext; 130 | while (_node != nullptr) { 131 | list_node_base* _temp = 132 | static_cast*>(_node); 133 | _node = _node->m_pNext; 134 | delete _temp; 135 | } 136 | } 137 | 138 | template 139 | auto list<_Tp>::assign(size_t _num, _Tp const& _value) -> void { 140 | this->clear(); 141 | this->insert_after(this->cbefore_begin(), _num, _value); 142 | } 143 | 144 | template 145 | void list<_Tp>::assign(iterator _first, iterator _last) -> void { 146 | this->clear(); 147 | this->insert_after(this->cbefore_begin(), _first, _last); 148 | } 149 | 150 | template 151 | void list<_Tp>::assign(const_iterator _first, const_iterator _last) -> void { 152 | this->clear(); 153 | this->insert_after(this->cbefore_begin(), _first, _last); 154 | } 155 | 156 | template 157 | auto list<_Tp>::back() -> _Tp& { 158 | return static_cast*>(m_pTail)->m_Value; 159 | } 160 | 161 | template 162 | auto list<_Tp>::back() const -> _Tp const& { 163 | return static_cast*>(m_pTail)->m_Value; 164 | } 165 | 166 | template 167 | auto list<_Tp>::before_begin() NOEXCEPT -> typename list<_Tp>::iterator { 168 | return list_iterator<_Tp>(&m_pHead); 169 | } 170 | 171 | template 172 | auto list<_Tp>::before_begin() const NOEXCEPT -> typename list<_Tp>::const_iterator { 173 | return list_const_iterator<_Tp>(&m_pHead); 174 | } 175 | 176 | template 177 | auto list<_Tp>::before_end() NOEXCEPT -> typename list<_Tp>::iterator { 178 | return list_iterator<_Tp>(&m_pTail); 179 | } 180 | 181 | template 182 | auto list<_Tp>::before_end() const NOEXCEPT -> typename list<_Tp>::const_iterator { 183 | return list_const_iterator<_Tp>(&m_pTail); 184 | } 185 | 186 | template 187 | auto list<_Tp>::begin() NOEXCEPT -> typename list<_Tp>::iterator { 188 | return list_iterator<_Tp>(m_pHead.m_pNext); 189 | } 190 | 191 | template 192 | auto list<_Tp>::begin() const NOEXCEPT -> typename list<_Tp>::const_iterator { 193 | return list_const_iterator<_Tp>(m_pHead.m_pNext); 194 | } 195 | 196 | template 197 | auto list<_Tp>::cbefore_begin() NOEXCEPT -> typename list<_Tp>::const_iterator{ 198 | return list_const_iterator<_Tp>(&m_pHead); 199 | } 200 | 201 | template 202 | auto list<_Tp>::cbegin() const NOEXCEPT -> typename list<_Tp>::const_iterator { 203 | return list_const_iterator<_Tp>(m_pHead.m_pNext); 204 | } 205 | 206 | template 207 | auto list<_Tp>::cend() const NOEXCEPT -> typename list<_Tp>::const_iterator { 208 | return list_const_iterator<_Tp>(nullptr); 209 | } 210 | 211 | template 212 | auto list<_Tp>::clear() NOEXCEPT -> void { 213 | while (!this->empty()) 214 | this->pop_front(); 215 | } 216 | 217 | template 218 | auto list<_Tp>::empty() const NOEXCEPT -> bool { 219 | return m_pHead.m_pNext == nullptr; 220 | } 221 | 222 | template 223 | auto list<_Tp>::end() NOEXCEPT -> typename list<_Tp>::iterator { 224 | return list_iterator<_Tp>( 225 | static_cast(nullptr)); 226 | } 227 | 228 | template 229 | auto list<_Tp>::end() const NOEXCEPT -> typename list<_Tp>::const_iterator { 230 | return list_const_iterator<_Tp>( 231 | static_cast(nullptr)); 232 | } 233 | 234 | template 235 | auto list<_Tp>::erase_after(const_iterator _position) -> typename list<_Tp>::iterator { 236 | list_node<_Tp>* _temp = 237 | static_cast*>(_position.m_pNode->m_pNext); 238 | _position.m_pNode->m_pNext = _temp->m_pNext; 239 | delete _temp; 240 | return list_iterator<_Tp>(_position.m_pNode->m_pNext); 241 | } 242 | 243 | template 244 | auto list<_Tp>::erase_after(const_iterator _first, const_iterator _last) -> typename list<_Tp>::iterator { 245 | list_node<_Tp>* _node_first = 246 | static_cast*>(_first.m_pNode->m_pNext); 247 | list_node<_Tp>* _node_last = 248 | static_cast*>(_last.m_pNode); 249 | while (_node_first != _node_last) { 250 | list_node<_Tp>* _temp = 251 | static_cast*>(_first.m_pNode->m_pNext); 252 | _first.m_pNode->m_pNext = _temp->m_pNext; 253 | delete _temp; 254 | _node_first = 255 | static_cast*>(_first.m_pNode->m_pNext); 256 | } 257 | return list_iterator<_Tp>(_first.m_pNode->m_pNext); 258 | } 259 | 260 | template 261 | auto list<_Tp>::front() -> _Tp& { 262 | return static_cast*>(m_pHead.m_pNext)->m_Value; 263 | } 264 | 265 | template 266 | auto list<_Tp>::front() const -> _Tp const& { 267 | return static_cast*>(m_pHead.m_pNext)->m_Value; 268 | } 269 | 270 | template 271 | auto list<_Tp>::insert_after(const_iterator _position, 272 | _Tp const& _value) -> void { 273 | list_node<_Tp>* _node = new list_node<_Tp>(_value); 274 | _node->m_pNext = _position.m_pNode->m_pNext; 275 | _position.m_pNode->m_pNext = _node; 276 | } 277 | 278 | template 279 | auto list<_Tp>::insert_after(const_iterator _position, 280 | _Tp&& _value) -> void { 281 | list_node<_Tp>* _node = 282 | new list_node<_Tp>(std::move(_value)); 283 | _node->m_pNext = _position.m_pNode->m_pNext; 284 | _position.m_pNode->m_pNext = _node; 285 | } 286 | 287 | template 288 | auto list<_Tp>::insert_after(const_iterator _position, size_t _num, 289 | _Tp const& _value) -> void { 290 | for (size_t i = 0; i < _num; ++i) 291 | this->insert_after(_position, _value); 292 | } 293 | 294 | template 295 | auto list<_Tp>::insert_after(const_iterator _position, 296 | iterator _first, iterator _last) -> void { 297 | for (; _first != _last; ++_position, ++_first) { 298 | this->insert_after(_position, 299 | static_cast*>(_first.m_pNode)->m_Value); 300 | } 301 | } 302 | 303 | template 304 | auto list<_Tp>::insert_after(const_iterator _position, 305 | const_iterator _first, const_iterator _last) -> void { 306 | for (; _first != _last; ++_position, ++_first) { 307 | this->insert_after(_position, 308 | static_cast*>(_first.m_pNode)->m_Value); 309 | } 310 | } 311 | 312 | template 313 | auto list<_Tp>::insert_before(const_iterator _position, 314 | _Tp const& _value) -> void { 315 | list_node<_Tp>* _node = new list_node<_Tp>(_value); 316 | _node->m_pPrev = _position.m_pNode->m_pPrev; 317 | _node->m_pNext = _position.m_pNode; 318 | _position.m_pNode->m_pPrev->m_pNext = _node; 319 | _position.m_pNode->m_pPrev = _node; 320 | } 321 | 322 | template 323 | auto list<_Tp>::insert_before(const_iterator _position, 324 | _Tp&& _value) -> void { 325 | list_node<_Tp>* _node = 326 | new list_node<_Tp>(std::move(_value)); 327 | _node->m_pPrev = _position.m_pNode->m_pPrev; 328 | _node->m_pNext = _position.m_pNode; 329 | _position.m_pNode->m_pPrev->m_pNext = _node; 330 | _position.m_pNode->m_pPrev = _node; 331 | } 332 | 333 | template 334 | auto list<_Tp>::insert_before(const_iterator _position, size_t _num, 335 | _Tp const& _value) -> void { 336 | for (size_t i = 0; i < _num; ++i) 337 | this->insert_before(_position, _value); 338 | } 339 | 340 | template 341 | auto list<_Tp>::insert_before(const_iterator _position, 342 | iterator _first, iterator _last) -> void { 343 | for (; _first != _last; ++_position, ++_first) { 344 | this->insert_before(_position, 345 | static_cast*>(_first.m_pNode)->m_Value); 346 | } 347 | } 348 | 349 | template 350 | auto list<_Tp>::insert_before(const_iterator _position, 351 | const_iterator _first, const_iterator _last) -> void { 352 | for (; _first != _last; ++_position, ++_first) { 353 | this->insert_before(_position, 354 | static_cast*>(_first.m_pNode)->m_Value); 355 | } 356 | } 357 | 358 | template 359 | auto list<_Tp>::operator=(list<_Tp> const& _list) -> list<_Tp>& { 360 | if (this != &_list) { 361 | list<_Tp> _temp(_list); 362 | this->swap(_temp); 363 | } 364 | return *this; 365 | } 366 | 367 | template 368 | auto list<_Tp>::operator=(list<_Tp>&& _list) -> list<_Tp>& { 369 | if (this != &_list) { 370 | m_pHead.m_pNext = std::move(_list.m_pHead).m_pNext; 371 | _list.m_pHead.m_pNext = nullptr; 372 | } 373 | return *this; 374 | } 375 | 376 | template 377 | auto list<_Tp>::pop_front() -> void { 378 | m_pHead.m_pNext = m_pHead.m_pNext->m_pNext; 379 | } 380 | 381 | template 382 | auto list<_Tp>::push_front(_Tp const& _value) -> void { 383 | list_node<_Tp>* _node = new list_node<_Tp>(_value); 384 | _node->m_pNext = m_pHead.m_pNext; 385 | m_pHead.m_pNext = _node; 386 | } 387 | 388 | template 389 | auto list<_Tp>::push_front(_Tp&& _value) -> void { 390 | list_node<_Tp>* _node = 391 | new list_node<_Tp>(std::move(_value)); 392 | _node->m_pNext = m_pHead.m_pNext; 393 | m_pHead.m_pNext = _node; 394 | } 395 | 396 | template 397 | auto list<_Tp>::remove(_Tp const& _value) -> void { 398 | list_node<_Tp>* _node = m_pHead.m_pNext; 399 | 400 | do { 401 | if (_node->m_Value == _value) { 402 | _node->m_pPrev->m_pNext = _node->m_pNext; 403 | break; 404 | } 405 | 406 | _node = _node->m_pNext; 407 | } while(_node != nullptr); 408 | } 409 | 410 | template 411 | auto list<_Tp>::reverse() NOEXCEPT -> void { 412 | list_node_base* _tail = m_pHead.m_pNext; 413 | if (!_tail) 414 | return; 415 | while (list_node_base* _temp = _tail->m_pNext) { 416 | list_node_base* _keep = m_pHead.m_pNext; 417 | m_pHead.m_pNext = _temp; 418 | _tail->m_pNext = _temp->m_pNext; 419 | m_pHead.m_pNext->m_pNext = _keep; 420 | } 421 | } 422 | 423 | template 424 | auto list<_Tp>::swap(list<_Tp>& _list) -> void { 425 | std::swap(this->m_pHead.m_pNext, _list.m_pHead.m_pNext); 426 | } 427 | 428 | } 429 | -------------------------------------------------------------------------------- /MyLibrary/List/list_const_iterator.h: -------------------------------------------------------------------------------- 1 | /** 2 | * list_const_interator.h 3 | * 4 | * @author Raul Butuc 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | #include 11 | #include "list_node.h" 12 | 13 | namespace my_library { 14 | 15 | template class list_node; 16 | 17 | template 18 | class list_const_iterator { 19 | 20 | public: 21 | 22 | typedef list_const_iterator<_Tp> const_iterator; 23 | typedef size_t size_type; 24 | typedef _Tp value_type; 25 | typedef _Tp& reference; 26 | typedef _Tp* pointer; 27 | typedef std::bidirectional_iterator_tag iterator_category; 28 | typedef size_t difference_type; 29 | 30 | auto operator++() -> const_iterator const&; 31 | auto operator++(int) -> const_iterator const&; 32 | auto operator+=(int) -> const_iterator const&; 33 | auto operator--() -> const_iterator const&; 34 | auto operator--(int) -> const_iterator const&; 35 | auto operator-=(int) -> const_iterator const&; 36 | auto operator*() const -> reference; 37 | auto operator->() const -> pointer; 38 | auto operator==(const_iterator const&) const -> bool; 39 | auto operator!=(const_iterator const&) const -> bool; 40 | 41 | private: 42 | 43 | list_node_base* m_pNode; 44 | 45 | list_const_iterator(list_node_base*); 46 | 47 | }; 48 | 49 | template 50 | list_const_iterator<_Tp>::list_const_iterator(list_node_base* _node) 51 | : m_pNode(_node) {} 52 | 53 | template 54 | auto list_const_iterator<_Tp>::operator++() 55 | -> typename list_const_iterator<_Tp>::const_iterator& { 56 | assert(m_pNode != nullptr); 57 | m_pNode = m_pNode->m_pNext; 58 | return *this; 59 | } 60 | 61 | template 62 | auto list_const_iterator<_Tp>::operator++(int) 63 | -> typename list_const_iterator<_Tp>::const_iterator const& { 64 | list_const_iterator<_Tp> _temp(*this); 65 | ++(*this); 66 | return _temp; 67 | } 68 | 69 | template 70 | auto list_const_iterator<_Tp>::operator+=(int _num) 71 | -> typename list_const_iterator<_Tp>::const_iterator const& { 72 | for (int i = 0; i < _num; ++i, ++(*this)); 73 | return *this; 74 | } 75 | 76 | template 77 | auto list_const_iterator<_Tp>::operator--() 78 | -> typename list_const_iterator<_Tp>::const_iterator const& { 79 | assert(m_pNode != nullptr); 80 | m_pNode = m_pNode->m_pPrev; 81 | return *this; 82 | } 83 | 84 | template 85 | auto list_const_iterator<_Tp>::operator--(int) 86 | -> typename list_const_iterator<_Tp>::const_iterator const& { 87 | list_const_iterator<_Tp> _temp(*this); 88 | --(*this); 89 | return _temp; 90 | } 91 | 92 | template 93 | auto list_const_iterator<_Tp>::operator-=(int _num) 94 | -> typename list_const_iterator<_Tp>::const_iterator const& { 95 | for (int i = 0; i < _num; ++i, --(*this)); 96 | return *this; 97 | } 98 | 99 | template 100 | auto list_const_iterator<_Tp>::operator*() const 101 | -> typename list_const_iterator<_Tp>::reference { 102 | return static_cast*>(m_pNode)->m_Value; 103 | } 104 | 105 | template 106 | auto list_const_iterator<_Tp>::operator->() const 107 | -> typename list_const_iterator<_Tp>::pointer { 108 | return static_cast*>(m_pNode); 109 | } 110 | 111 | template 112 | auto list_const_iterator<_Tp>::operator==( 113 | const_iterator const& _position) const -> bool { 114 | return m_pNode == _position.m_pNode; 115 | } 116 | 117 | template 118 | auto list_const_iterator<_Tp>::operator!=( 119 | const_iterator const& _position) const -> bool { 120 | return m_pNode != _position.m_pNode; 121 | } 122 | 123 | } 124 | -------------------------------------------------------------------------------- /MyLibrary/List/list_iterator.h: -------------------------------------------------------------------------------- 1 | /** 2 | * list_iterator.h 3 | * 4 | * @author Raul Butuc 5 | */ 6 | 7 | #pragma once 8 | 9 | #include 10 | #include 11 | #include "list_node.h" 12 | 13 | namespace my_library { 14 | 15 | template class list_node; 16 | 17 | template 18 | class list_iterator { 19 | 20 | public: 21 | 22 | typedef list_iterator<_Tp> iterator; 23 | typedef size_t size_type; 24 | typedef _Tp value_type; 25 | typedef _Tp& reference; 26 | typedef _Tp* pointer; 27 | typedef std::forward_iterator_tag iterator_category; 28 | typedef size_t difference_type; 29 | 30 | auto operator++() -> iterator const&; 31 | auto operator++(int) -> iterator const&; 32 | auto operator+=(int) -> iterator const&; 33 | auto operator--() -> iterator const&; 34 | auto operator--(int) -> iterator const&; 35 | auto operator-=(int) -> iterator const&; 36 | auto operator*() const -> reference; 37 | auto operator->() const -> pointer; 38 | auto operator==(iterator const&) const -> bool; 39 | auto operator!=(iterator const&) const -> bool; 40 | 41 | private: 42 | 43 | list_node_base* m_pNode; 44 | 45 | list_iterator(list_node_base*); 46 | 47 | }; 48 | 49 | template 50 | list_iterator<_Tp>::list_iterator(list_node_base* _node) 51 | : m_pNode(_node) {} 52 | 53 | template 54 | auto list_iterator<_Tp>::operator++() 55 | -> typename list_iterator<_Tp>::iterator const& { 56 | assert(m_pNode != nullptr); 57 | m_pNode = m_pNode->m_pNext; 58 | return *this; 59 | } 60 | 61 | template 62 | auto list_iterator<_Tp>::operator++(int) 63 | -> typename list_iterator<_Tp>::iterator const& { 64 | list_iterator<_Tp> _temp(*this); 65 | ++(*this); 66 | return _temp; 67 | } 68 | 69 | template 70 | auto list_iterator<_Tp>::operator+=(int _num) 71 | -> typename list_iterator<_Tp>::iterator const&{ 72 | for (int i = 0; i < _num; ++i, ++(*this)); 73 | return *this; 74 | } 75 | 76 | template 77 | auto list_iterator<_Tp>::operator--() 78 | -> typename list_iterator<_Tp>::iterator const& { 79 | assert(m_pNode != nullptr); 80 | m_pNode = m_pNode->m_pPrev; 81 | return *this; 82 | } 83 | 84 | template 85 | auto list_iterator<_Tp>::operator--(int) 86 | -> typename list_iterator<_Tp>::iterator const& { 87 | list_iterator<_Tp> _temp(*this); 88 | --(*this); 89 | return _temp; 90 | } 91 | 92 | template 93 | auto list_iterator<_Tp>::operator-=(int _num) 94 | -> typename list_iterator<_Tp>::iterator const& { 95 | for (int i = 0; i < _num; ++i, --(*this)); 96 | return *this; 97 | } 98 | 99 | template 100 | auto list_iterator<_Tp>::operator*() const 101 | -> typename list_iterator<_Tp>::reference { 102 | return static_cast*>(m_pNode)->m_Value; 103 | } 104 | 105 | template 106 | auto list_iterator<_Tp>::operator->() const 107 | -> typename list_iterator<_Tp>::pointer { 108 | return static_cast*>(m_pNode); 109 | } 110 | 111 | template 112 | auto list_iterator<_Tp>::operator==( 113 | iterator const& _position) const -> bool { 114 | return m_pNode == _position.m_pNode; 115 | } 116 | 117 | template 118 | auto list_iterator<_Tp>::operator!=( 119 | iterator const& _position) const -> bool { 120 | return m_pNode != _position.m_pNode; 121 | } 122 | 123 | } 124 | -------------------------------------------------------------------------------- /MyLibrary/List/list_node.h: -------------------------------------------------------------------------------- 1 | /** 2 | * list_node.h 3 | * 4 | * @author Raul Butuc 5 | */ 6 | 7 | #pragma once 8 | 9 | #include "list_node_base.h" 10 | 11 | namespace my_library { 12 | 13 | template 14 | class list_node : public list_node_base { 15 | 16 | private: 17 | 18 | _Tp m_Value; 19 | 20 | list_node(_Tp const&); 21 | 22 | }; 23 | 24 | template 25 | list_node<_Tp>::list_node(_Tp const& _value) 26 | : m_Value(_value), list_node_base() {} 27 | 28 | } 29 | -------------------------------------------------------------------------------- /MyLibrary/List/list_node_base.h: -------------------------------------------------------------------------------- 1 | /** 2 | * list_node_base.h 3 | * 4 | * @author Raul Butuc 5 | */ 6 | 7 | #pragma once 8 | 9 | namespace my_library { 10 | 11 | class list_node_base { 12 | 13 | public: 14 | 15 | list_node_base* m_pNext; 16 | list_node_base* m_pPrev; 17 | 18 | list_node_base(); 19 | 20 | }; 21 | 22 | list_node_base::list_node_base() 23 | : m_pNext(nullptr), m_pPrev(nullptr) {} 24 | 25 | } 26 | -------------------------------------------------------------------------------- /MyLibrary/MyLibrary.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25123.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Forward List", "Forward List\Forward List.vcxproj", "{BEE915DE-78FF-4ED4-BF26-018CDF08AB7A}" 7 | ProjectSection(ProjectDependencies) = postProject 8 | {375BA0BC-626A-4501-BC04-4CA3A3A7E5A6} = {375BA0BC-626A-4501-BC04-4CA3A3A7E5A6} 9 | EndProjectSection 10 | EndProject 11 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "List", "List\List.vcxproj", "{4C8CB3C8-3289-4472-A842-F942DE01A3D1}" 12 | ProjectSection(ProjectDependencies) = postProject 13 | {375BA0BC-626A-4501-BC04-4CA3A3A7E5A6} = {375BA0BC-626A-4501-BC04-4CA3A3A7E5A6} 14 | EndProjectSection 15 | EndProject 16 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest", "Unit Test\Unit Test.vcxproj", "{375BA0BC-626A-4501-BC04-4CA3A3A7E5A6}" 17 | EndProject 18 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Binary Search Tree", "Binary Search Tree\Binary Search Tree.vcxproj", "{A868CD63-08A9-4B2C-84C4-786920A5AECF}" 19 | EndProject 20 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Graph", "Graph\Graph.vcxproj", "{73AB4480-2264-4736-91C8-8DE6F0BBC1D2}" 21 | ProjectSection(ProjectDependencies) = postProject 22 | {4C8CB3C8-3289-4472-A842-F942DE01A3D1} = {4C8CB3C8-3289-4472-A842-F942DE01A3D1} 23 | EndProjectSection 24 | EndProject 25 | Global 26 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 27 | Debug|Win32 = Debug|Win32 28 | Debug|x64 = Debug|x64 29 | Release|Win32 = Release|Win32 30 | Release|x64 = Release|x64 31 | EndGlobalSection 32 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 33 | {BEE915DE-78FF-4ED4-BF26-018CDF08AB7A}.Debug|Win32.ActiveCfg = Debug|Win32 34 | {BEE915DE-78FF-4ED4-BF26-018CDF08AB7A}.Debug|Win32.Build.0 = Debug|Win32 35 | {BEE915DE-78FF-4ED4-BF26-018CDF08AB7A}.Debug|x64.ActiveCfg = Debug|Win32 36 | {BEE915DE-78FF-4ED4-BF26-018CDF08AB7A}.Release|Win32.ActiveCfg = Release|Win32 37 | {BEE915DE-78FF-4ED4-BF26-018CDF08AB7A}.Release|Win32.Build.0 = Release|Win32 38 | {BEE915DE-78FF-4ED4-BF26-018CDF08AB7A}.Release|x64.ActiveCfg = Release|Win32 39 | {4C8CB3C8-3289-4472-A842-F942DE01A3D1}.Debug|Win32.ActiveCfg = Debug|Win32 40 | {4C8CB3C8-3289-4472-A842-F942DE01A3D1}.Debug|Win32.Build.0 = Debug|Win32 41 | {4C8CB3C8-3289-4472-A842-F942DE01A3D1}.Debug|x64.ActiveCfg = Debug|Win32 42 | {4C8CB3C8-3289-4472-A842-F942DE01A3D1}.Release|Win32.ActiveCfg = Release|Win32 43 | {4C8CB3C8-3289-4472-A842-F942DE01A3D1}.Release|Win32.Build.0 = Release|Win32 44 | {4C8CB3C8-3289-4472-A842-F942DE01A3D1}.Release|x64.ActiveCfg = Release|Win32 45 | {375BA0BC-626A-4501-BC04-4CA3A3A7E5A6}.Debug|Win32.ActiveCfg = Debug|Win32 46 | {375BA0BC-626A-4501-BC04-4CA3A3A7E5A6}.Debug|Win32.Build.0 = Debug|Win32 47 | {375BA0BC-626A-4501-BC04-4CA3A3A7E5A6}.Debug|x64.ActiveCfg = Debug|Win32 48 | {375BA0BC-626A-4501-BC04-4CA3A3A7E5A6}.Release|Win32.ActiveCfg = Release|Win32 49 | {375BA0BC-626A-4501-BC04-4CA3A3A7E5A6}.Release|Win32.Build.0 = Release|Win32 50 | {375BA0BC-626A-4501-BC04-4CA3A3A7E5A6}.Release|x64.ActiveCfg = Release|Win32 51 | {A868CD63-08A9-4B2C-84C4-786920A5AECF}.Debug|Win32.ActiveCfg = Debug|Win32 52 | {A868CD63-08A9-4B2C-84C4-786920A5AECF}.Debug|Win32.Build.0 = Debug|Win32 53 | {A868CD63-08A9-4B2C-84C4-786920A5AECF}.Debug|x64.ActiveCfg = Debug|Win32 54 | {A868CD63-08A9-4B2C-84C4-786920A5AECF}.Release|Win32.ActiveCfg = Release|Win32 55 | {A868CD63-08A9-4B2C-84C4-786920A5AECF}.Release|Win32.Build.0 = Release|Win32 56 | {A868CD63-08A9-4B2C-84C4-786920A5AECF}.Release|x64.ActiveCfg = Release|Win32 57 | {73AB4480-2264-4736-91C8-8DE6F0BBC1D2}.Debug|Win32.ActiveCfg = Debug|Win32 58 | {73AB4480-2264-4736-91C8-8DE6F0BBC1D2}.Debug|Win32.Build.0 = Debug|Win32 59 | {73AB4480-2264-4736-91C8-8DE6F0BBC1D2}.Debug|x64.ActiveCfg = Debug|x64 60 | {73AB4480-2264-4736-91C8-8DE6F0BBC1D2}.Debug|x64.Build.0 = Debug|x64 61 | {73AB4480-2264-4736-91C8-8DE6F0BBC1D2}.Release|Win32.ActiveCfg = Release|Win32 62 | {73AB4480-2264-4736-91C8-8DE6F0BBC1D2}.Release|Win32.Build.0 = Release|Win32 63 | {73AB4480-2264-4736-91C8-8DE6F0BBC1D2}.Release|x64.ActiveCfg = Release|x64 64 | {73AB4480-2264-4736-91C8-8DE6F0BBC1D2}.Release|x64.Build.0 = Release|x64 65 | EndGlobalSection 66 | GlobalSection(SolutionProperties) = preSolution 67 | HideSolutionNode = FALSE 68 | EndGlobalSection 69 | EndGlobal 70 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MyLibrary 2 | A personal and custom library that will eventually contain all the common data structures. The implementation uses templates and custom iterators to allow the usage of the common STL algorithms on the containers (where possible). The project also contains a custom (minimal) unit test framework. 3 | 4 | ### Data structures included so far 5 | 6 | - Singly Linked List (Forward List) 7 | - Doubly Linked List (List) 8 | - Binary Search Tree 9 | - Graph 10 | 11 | ### Coming soon 12 | 13 | - Stack 14 | - Queue 15 | - Double Ended Queue (Deque) 16 | - Treap 17 | - Red-Black Tree 18 | - AVL Tree 19 | - Trie 20 | --------------------------------------------------------------------------------