summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOskar <[email protected]>2024-07-31 17:09:45 +0200
committerOskar <[email protected]>2024-07-31 17:09:45 +0200
commita450487a18ec72ea3a3815bfaf17b2f701796b6f (patch)
tree67b4cfe127bc5c134f06c06e57ad35629e630b7b
parentb7819b597e1241dd98643eeda4c288a341142311 (diff)
more
-rw-r--r--.idea/.gitignore8
-rw-r--r--.idea/editor.xml103
-rw-r--r--.idea/misc.xml18
-rw-r--r--.idea/vcs.xml6
-rw-r--r--2p32.cpp7
-rw-r--r--2p33-2p34.cpp47
-rw-r--r--2p35.cpp28
-rw-r--r--2p36.cpp22
-rw-r--r--2p37.cpp24
-rw-r--r--2p38.cpp28
-rw-r--r--auto-test.cpp30
-rw-r--r--decltype-tests.cpp28
12 files changed, 211 insertions, 138 deletions
diff --git a/.idea/.gitignore b/.idea/.gitignore
deleted file mode 100644
index 13566b8..0000000
--- a/.idea/.gitignore
+++ /dev/null
@@ -1,8 +0,0 @@
-# Default ignored files
-/shelf/
-/workspace.xml
-# Editor-based HTTP Client requests
-/httpRequests/
-# Datasource local storage ignored files
-/dataSources/
-/dataSources.local.xml
diff --git a/.idea/editor.xml b/.idea/editor.xml
deleted file mode 100644
index 855412d..0000000
--- a/.idea/editor.xml
+++ /dev/null
@@ -1,103 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
- <component name="BackendCodeEditorSettings">
- <option name="/Default/Housekeeping/GlobalSettingsUpgraded/IsUpgraded/@EntryValue" value="true" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppClangFormat/EnableClangFormatSupport/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/EditorConfig/EnableClangFormatSupport/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_BINARY_EXPRESSIONS_CHAIN/@EntryValue" value="true" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_CALLS_CHAIN/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_EXPRESSION/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_FOR_STMT/@EntryValue" value="true" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTIPLE_DECLARATION/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_TERNARY/@EntryValue" value="ALIGN_ALL" type="string" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_CLASS_DEFINITION/@EntryValue" value="1" type="int" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_BLANK_LINES_IN_DECLARATIONS/@EntryValue" value="2" type="int" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_BLANK_LINES_IN_CODE/@EntryValue" value="2" type="int" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/KEEP_USER_LINEBREAKS/@EntryValue" value="true" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_CASE_FROM_SWITCH/@EntryValue" value="true" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_COMMENT/@EntryValue" value="true" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INT_ALIGN_EQ/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SIMPLE_BLOCK_STYLE/@EntryValue" value="DO_NOT_CHANGE" type="string" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COMMA_IN_TEMPLATE_ARGS/@EntryValue" value="true" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COMMA_IN_TEMPLATE_PARAMS/@EntryValue" value="true" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_FOR_SEMICOLON/@EntryValue" value="true" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_FOR_SEMICOLON/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_UNARY_OPERATOR/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_ARRAY_ACCESS_BRACKETS/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_CAST_EXPRESSION_PARENTHESES/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_INITIALIZER_BRACES/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_METHOD_PARENTHESES/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_INITIALIZER_BRACES/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPECIAL_ELSE_IF_TREATMENT/@EntryValue" value="true" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_CAST_EXPRESSION_PARENTHESES/@EntryValue" value="true" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_BINARY_OPSIGN/@EntryValue" value="true" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_TERNARY_OPSIGNS/@EntryValue" value="true" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/TYPE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/OTHER_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CASE_BLOCK_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_FUNCTION_DECLARATION/@EntryValue" value="1" type="int" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_FUNCTION_DEFINITION/@EntryValue" value="1" type="int" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_WHILE_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_ELSE_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_CATCH_ON_NEW_LINE/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/NAMESPACE_INDENTATION/@EntryValue" value="All" type="string" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_ARGUMENT/@EntryValue" value="true" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_EXTENDS_LIST/@EntryValue" value="true" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_PARAMETER/@EntryValue" value="true" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_TYPE_ARGUMENT/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ALIGN_MULTILINE_TYPE_PARAMETER/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BLANK_LINES_AROUND_DECLARATIONS/@EntryValue" value="0" type="int" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_ACCESS_SPECIFIERS_FROM_CLASS/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_CLASS_MEMBERS_FROM_ACCESS_SPECIFIERS/@EntryValue" value="true" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/LINE_BREAK_AFTER_COLON_IN_MEMBER_INITIALIZER_LISTS/@EntryValue" value="ON_SINGLE_LINE" type="string" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/MEMBER_INITIALIZER_LIST_STYLE/@EntryValue" value="DO_NOT_CHANGE" type="string" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/PLACE_NAMESPACE_DEFINITIONS_ON_SAME_LINE/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_COLON_IN_BITFIELD_DECLARATOR/@EntryValue" value="true" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_COLON_IN_BITFIELD_DECLARATOR/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_EXTENDS_COLON/@EntryValue" value="true" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_EXTENDS_COLON/@EntryValue" value="true" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_FOR_COLON/@EntryValue" value="true" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_FOR_COLON/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_DATA_MEMBER/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_DATA_MEMBERS/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_METHOD/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_PTR_IN_NESTED_DECLARATOR/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_DATA_MEMBER/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_DATA_MEMBERS/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_AFTER_REF_IN_METHOD/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_ABSTRACT_DECL/@EntryValue" value="true" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_DATA_MEMBER/@EntryValue" value="true" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_DATA_MEMBERS/@EntryValue" value="true" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_PTR_IN_METHOD/@EntryValue" value="true" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_ABSTRACT_DECL/@EntryValue" value="true" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_DATA_MEMBER/@EntryValue" value="true" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_DATA_MEMBERS/@EntryValue" value="true" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_REF_IN_METHOD/@EntryValue" value="true" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_TEMPLATE_ARGS/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BEFORE_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_BETWEEN_CLOSING_ANGLE_BRACKETS_IN_TEMPLATE_ARGS/@EntryValue" value="true" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_TEMPLATE_ARGS/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_TEMPLATE_PARAMS/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_DECLARATION_PARENTHESES/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/SPACE_WITHIN_EMPTY_BLOCKS/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_INVOCATION_LPAR/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_INVOCATION_LPAR/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_INVOCATION_RPAR/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_DECLARATION_LPAR/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_AFTER_DECLARATION_LPAR/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_BEFORE_DECLARATION_RPAR/@EntryValue" value="false" type="bool" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_ARGUMENTS_STYLE/@EntryValue" value="WRAP_IF_LONG" type="string" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/WRAP_PARAMETERS_STYLE/@EntryValue" value="WRAP_IF_LONG" type="string" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/BREAK_TEMPLATE_DECLARATION/@EntryValue" value="LINE_BREAK" type="string" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/NAMESPACE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/FREE_BLOCK_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INVOCABLE_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/ANONYMOUS_METHOD_DECLARATION_BRACES/@EntryValue" value="END_OF_LINE" type="string" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INITIALIZER_BRACES/@EntryValue" value="END_OF_LINE_NO_SPACE" type="string" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_STYLE/@EntryValue" value="Space" type="string" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/INDENT_SIZE/@EntryValue" value="4" type="int" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/CONTINUOUS_LINE_INDENT/@EntryValue" value="Double" type="string" />
- <option name="/Default/CodeStyle/CodeFormatting/CppFormatting/TAB_WIDTH/@EntryValue" value="4" type="int" />
- </component>
-</project> \ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index 53624c9..0000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
- <component name="ExternalStorageConfigurationManager" enabled="true" />
- <component name="MakefileSettings">
- <option name="linkedExternalProjectsSettings">
- <MakefileProjectSettings>
- <option name="externalProjectPath" value="$PROJECT_DIR$" />
- <option name="modules">
- <set>
- <option value="$PROJECT_DIR$" />
- </set>
- </option>
- <option name="version" value="2" />
- </MakefileProjectSettings>
- </option>
- </component>
- <component name="MakefileWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
-</project> \ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 35eb1dd..0000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
- <component name="VcsDirectoryMappings">
- <mapping directory="" vcs="Git" />
- </component>
-</project> \ No newline at end of file
diff --git a/2p32.cpp b/2p32.cpp
index 1e7211f..5fa6c3e 100644
--- a/2p32.cpp
+++ b/2p32.cpp
@@ -3,14 +3,15 @@
/*
*
- * 2.32
+ * exersice 2.32 c++ primer
*
*
*/
int main () {
- int null = 0, *p = null;
- std::cout << null << " " << *p << std::endl;
+ int null1 = 0, *p1 = &null1; // Add a & ?
+ std::cout << null1 << " " << *p1 << std::endl;
+
return 0;
}
diff --git a/2p33-2p34.cpp b/2p33-2p34.cpp
new file mode 100644
index 0000000..bc16416
--- /dev/null
+++ b/2p33-2p34.cpp
@@ -0,0 +1,47 @@
+#include <iostream>
+#include "sales_item.hpp"
+
+/*
+ *
+ * 2.33, 2.34
+ *
+ *
+ */
+
+int main () {
+
+ int i = 0, &r = i;
+ const int ci = i, &cr = ci;
+
+ auto a = r; // int
+ auto b = ci; // int
+ auto c = cr; // int
+ auto d = &i; // int *
+ auto e = &ci; // const int *
+ const auto f = ci; // const int
+ auto &g = ci; // const int &
+ std::cout << a << " " << b << " " << c << " " << d << " "
+ << e << " " << f << " " << g << std::endl;
+
+ a = 42; // valid
+ std::cout << a << std::endl;
+
+ b = 42; // valid
+ std::cout << a << std::endl;
+
+ c = 42; // valid
+ std::cout << a << std::endl;
+
+ //d = 42; // inValid
+ //std::cout << a << std::endl;
+
+ //e = 42; // inValid
+ //std::cout << a << std::endl;
+
+ //f = 42; // inValid
+ //std::cout << a << std::endl;
+
+ //g = 42; // inValid
+ //std::cout << a << std::endl;
+ return 0;
+}
diff --git a/2p35.cpp b/2p35.cpp
new file mode 100644
index 0000000..ce34e47
--- /dev/null
+++ b/2p35.cpp
@@ -0,0 +1,28 @@
+#include <iostream>
+#include "sales_item.hpp"
+
+/*
+ *
+ * 2.35
+ *
+ *
+ */
+
+int main () {
+
+ const int i = 42; // const int
+ auto j = i; // int
+ const auto &k = i; // const int&
+ auto *p = &i; // pointer to const int? (const int*) or pointer to pointer?
+ auto p2 = &i;
+ const auto j2 = i, &k2 = i;
+ // const int // reference to const int (const int&)
+ std::cout << i << "\n"
+ << j << "\n"
+ << k << "\n"
+ << p << "\n"
+ << p2 << "\n"
+ << j2 << "\n"
+ << k2 << std::endl;
+ return 0;
+}
diff --git a/2p36.cpp b/2p36.cpp
new file mode 100644
index 0000000..73f02b7
--- /dev/null
+++ b/2p36.cpp
@@ -0,0 +1,22 @@
+#include <iostream>
+#include "sales_item.hpp"
+
+/*
+ *
+ * 2.36
+ *
+ *
+ */
+
+int main () {
+
+ int a = 3;
+ int b = 4;
+ decltype(a) c = a; // int // c == 3
+ decltype((b)) d = a; // int& // d == 3
+ ++c; // 4
+ ++d; // 4
+ std::cout << c << " <c\n" << d << " <d" << std::endl;
+ std::cout << b << std::endl;
+ return 0;
+}
diff --git a/2p37.cpp b/2p37.cpp
new file mode 100644
index 0000000..445ce22
--- /dev/null
+++ b/2p37.cpp
@@ -0,0 +1,24 @@
+#include <iostream>
+#include "sales_item.hpp"
+
+/*
+ *
+ * 2.37
+ *
+ *
+ */
+
+int main () {
+
+ int a = 3;
+ int b = 4;
+ decltype(a) c = a; //int
+ //decltype(a = b) d = a; // int&
+ std::cout << a << " "
+ << b << " "
+ << c << " "
+ //<< d << " "
+ <<std::endl;
+
+ return 0;
+}
diff --git a/2p38.cpp b/2p38.cpp
new file mode 100644
index 0000000..dbaaf0d
--- /dev/null
+++ b/2p38.cpp
@@ -0,0 +1,28 @@
+#include <iostream>
+#include "sales_item.hpp"
+
+/*
+ *
+ * 2.38
+ * auto ignores toplevel const and reference
+ * decltype included toplevel const and reference
+ */
+
+int main () {
+
+ int i = 109; //int
+ int *pi = &i; //int*
+ const int ff = 1; // const int
+
+ auto ffi = ff; //int
+ decltype(ff) ffd = 100; //const int
+ auto ai = *pi; // int
+ decltype(*pi) di = i; //int&
+
+ std::cout << ai << " " // 109
+ << di << " " // 109
+ << ffi << " " // 1
+ << ffd << " " // 100
+ << std::endl;
+ return 0;
+}
diff --git a/auto-test.cpp b/auto-test.cpp
new file mode 100644
index 0000000..919e1e4
--- /dev/null
+++ b/auto-test.cpp
@@ -0,0 +1,30 @@
+#include <iostream>
+#include "sales_item.hpp"
+
+/*
+ *
+ * testing with auto
+ *
+ *
+ */
+
+int main () {
+
+ double ff = 3.14;
+ auto i = 0, *p = &i;
+ auto i2 = 0.0, i3 = ff;
+ std::cout << i << " " << *p << " " << i2 << " " << i3 << std::endl;
+ const int gg = 66;
+ const auto pgg = &gg; // if we want toplevel const then we have to say it before auto
+ std::cout << gg << " <gg\n" << *pgg << " <*pgg" << std::endl;
+ std::cout << &gg << " <&gg\n" << pgg << " <pgg" << std::endl;
+
+ int ci = 99;
+ auto &g = ci;
+ const auto &j = 42; // ok: we can bind a const reference to a literal
+ std::cout << g << " <g\n" << j << " <j" << std::endl;
+ g += 1;
+ //j += 1; // Not possible
+ std::cout << g << " <g\n" << j << " <j" << std::endl;
+ return 0;
+}
diff --git a/decltype-tests.cpp b/decltype-tests.cpp
new file mode 100644
index 0000000..d0bf7e2
--- /dev/null
+++ b/decltype-tests.cpp
@@ -0,0 +1,28 @@
+#include <iostream>
+#include "sales_item.hpp"
+
+/*
+ *
+ * decltype testing
+ *
+ *
+ */
+
+int main () {
+
+ int i = 100;
+ int &ii = i;
+ int *iii = &i;
+
+ decltype(i) dti = 101; //int
+ decltype(ii) dtii = dti; //int&
+ decltype(ii + 0) dtii2 = 102; //int
+ decltype(*iii) dtiii = i; //int&
+ decltype(*iii + 0) dtiii2 = i; //int
+ std::cout << dti << " " // Will print 101
+ << dtii << " " // Will print 101
+ << dtii2 << " " // Will print 102
+ << dtiii << " " // Will print 100
+ << dtiii2 << " " << std::endl; // Will print 100
+ return 0;
+}