Warning: The magic method Slickr_Flickr_Plugin::__wakeup() must have public visibility in /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php on line 152

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101winter2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101winter2015/wp-includes/rest-api/class-wp-rest-server.php on line 1831
{"id":13899,"date":"2015-05-06T12:33:32","date_gmt":"2015-05-06T17:33:32","guid":{"rendered":"https:\/\/mauriciocoopera.withknown.com\/2015\/mastery-23"},"modified":"2015-05-06T12:33:32","modified_gmt":"2015-05-06T17:33:32","slug":"mastery-23-12","status":"publish","type":"post","link":"https:\/\/kenscourses.com\/tc101winter2015\/2015\/mastery-23-12\/","title":{"rendered":"Mastery 23"},"content":{"rendered":"
\n

Creation and use of vectors in C++<\/span><\/p>\n

Vector<\/div>\n

\u00a0<\/p>\n

\n

Vectors are sequence containers representing arrays that can change in size.<\/p>\n

Just like arrays, vectors use contiguous storage locations for their elements, which means that their elements can also be accessed using offsets on regular pointers to its elements, and just as efficiently as in arrays. But unlike arrays, their size can change dynamically, with their storage being handled automatically by the container.<\/p>\n

Internally, vectors use a dynamically allocated array to store their elements. This array may need to be reallocated in order to grow in size when new elements are inserted, which implies allocating a new array and moving all elements to it. This is a relatively expensive task in terms of processing time, and thus, vectors do not reallocate each time an element is added to the container.<\/p>\n<\/section>\n

<\/section>\n
\n
\n

Example<\/h3>\n
\n\n\n\n
#a0a0a0; text-align: right; vertical-align: top; min-width: 20px;”><\/p>\n
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<\/code><\/pre>\n<\/td>\n
#c0c0d0; vertical-align: top; background: #efefff;”><\/p>\n
\/\/ constructing vectors<\/cite>\n#include<\/a> <\/iostream><\/dfn>\n#include<\/a> <\/vector><\/dfn>\n\nint<\/var> main ()\n{\n  \/\/ constructors used in the same order as described above:<\/cite>\n  std::vectorint> first;                                \/\/ empty vector of ints<\/cite>\n  std::vectorint> second (4,100);                       \/\/ four ints with value 100<\/cite>\n  std::vectorint> third (second.begin(),second.end());  \/\/ iterating through second<\/cite>\n  std::vectorint> fourth (third);                       \/\/ a copy of third<\/cite>\n\n  \/\/ the iterator constructor can also be used to construct from arrays:<\/cite>\n  int<\/var> myints[] = {16,2,77,29};\n  std::vectorint> fifth (myints, myints + sizeof<\/var>(myints) \/ sizeof<\/var>(int<\/var>) );\n\n  std::cout \"The contents of fifth are:\";\n  for<\/var> (std::vectorint>::iterator it = fifth.begin(); it != fifth.end(); ++it)\n    std::cout ' ' 'n';\n\n  return<\/var> 0;\n}<\/code><\/pre>\n<\/td>\n
\n
\n
\n
#c0c0d0; width: 16px; height: 16px; border-top-right-radius: 3px; border-bottom-right-radius: 3px;”>Edit & Run<\/a><\/div>\n<\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n

Output:<\/p>\n

\n\n\n\n
#e7e7e7;”><\/p>\n
The contents of fifth are: 16 2 77 29 \n<\/samp><\/pre>\n

\u00a0<\/samp><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/section>\n<\/section>\n

Credits:<\/span><\/p>\n

<\/a>http:\/<\/wbr>\/<\/wbr>www.cplusplus.com\/<\/wbr>reference\/<\/wbr>vector\/<\/wbr>vector\/<\/wbr>vector\/<\/wbr><\/a><\/span><\/p>\n

<\/a>http:\/<\/wbr>\/<\/wbr>www.cplusplus.com\/<\/wbr>reference\/<\/wbr>vector\/<\/wbr>vector\/<\/wbr><\/a><\/span><\/p>\n

#TC<\/a>1017 #Mastery<\/a>23<\/span><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"

\n

Creation and use of vectors in C++<\/span><\/p>\n

Vector<\/div>\n

 <\/p>\n

\n

Vectors are sequence containers representing arrays that can change in size.<\/p>\n

Just like arrays, vectors use contiguous storage locations for their elements, which means that their elements can also be accessed using offsets on regular pointers to its elements, and just as efficiently as in arrays. But unlike arrays, their size can change dynamically, with their storage being handled automatically by the container.<\/p>\n

Internally, vectors use a dynamically allocated array to store their elements. This array may need to be reallocated in order to grow in size when new elements are inserted, which implies allocating a new array and moving all elements to it. This is a relatively expensive task in terms of processing time, and thus, vectors do not reallocate each time an element is added to the container.<\/p>\n<\/section>\n

<\/section>\n
\n
\n

Example<\/h3>\n
\n\n\n\n
#a0a0a0; text-align: right; vertical-align: top; min-width: 20px;”><\/p>\n
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<\/code><\/pre>\n<\/td>\n
#c0c0d0; vertical-align: top; background: #efefff;”><\/p>\n
\/\/ constructing vectors<\/cite>\n#include<\/a> <\/dfn>\n#include<\/a> <\/dfn>\n\nint<\/var> main ()\n{\n  \/\/ constructors used in the same order as described above:<\/cite>\n  std::vectorint> first;                                \/\/ empty vector of ints<\/cite>\n  std::vectorint> second (4,100);                       \/\/ four ints with value 100<\/cite>\n  std::vectorint> third (second.begin(),second.end());  \/\/ iterating through second<\/cite>\n  std::vectorint> fourth (third);                       \/\/ a copy of third<\/cite>\n\n  \/\/ the iterator constructor can also be used to construct from arrays:<\/cite>\n  int<\/var> myints[] = {16,2,77,29};\n  std::vectorint> fifth (myints, myints + sizeof<\/var>(myints) \/ sizeof<\/var>(int<\/var>) );\n\n  std::cout \"The contents of fifth are:\";\n  for<\/var> (std::vectorint>::iterator it = fifth.begin(); it != fifth.end(); ++it)\n    std::cout ' ' 'n';\n\n  return<\/var> 0;\n}<\/code><\/pre>\n<\/td>\n
\n
\n
\n
#c0c0d0; width: 16px; height: 16px; border-top-right-radius: 3px; border-bottom-right-radius: 3px;”>Edit & Run<\/a><\/div>\n<\/div>\n<\/div>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n

Output:<\/p>\n

\n\n\n\n
#e7e7e7;”><\/p>\n
The contents of fifth are: 16 2 77 29 \n<\/samp><\/pre>\n

 <\/samp><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/section>\n<\/section>\n

Credits:<\/span><\/p>\n

<\/a>http:\/\/www.cplusplus.com\/reference\/vector\/vector\/vector\/<\/a><\/span><\/p>\n

<\/a>http:\/\/www.cplusplus.com\/reference\/vector\/vector\/<\/a><\/span><\/p>\n

#TC<\/a>1017 #Mastery<\/a>23<\/span><\/p>\n<\/div>\n

Continue reading →<\/span><\/a><\/p>\n","protected":false},"author":115,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,3,26],"tags":[318,330,329,144,398,328,325,326,399,327,95,245,486,40,287],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/posts\/13899"}],"collection":[{"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/users\/115"}],"replies":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/comments?post=13899"}],"version-history":[{"count":6,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/posts\/13899\/revisions"}],"predecessor-version":[{"id":19156,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/posts\/13899\/revisions\/19156"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/media?parent=13899"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/categories?post=13899"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2015\/wp-json\/wp\/v2\/tags?post=13899"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}