Skip to content

Commit

Permalink
Update to 2.0.0a2
Browse files Browse the repository at this point in the history
  • Loading branch information
MasatoKokubo committed Jan 26, 2020
1 parent 906b08a commit 9b143ea
Show file tree
Hide file tree
Showing 14 changed files with 1,400 additions and 86 deletions.
2 changes: 1 addition & 1 deletion Example/linux/.cproject
Expand Up @@ -55,7 +55,7 @@

</option>

<option id="gnu.cpp.compiler.option.dialect.flags.1848679113" name="Other dialect flags" superClass="gnu.cpp.compiler.option.dialect.flags" useByScannerDiscovery="true" value="-std=c++2a" valueType="string"/>
<option id="gnu.cpp.compiler.option.dialect.flags.1848679113" name="Other dialect flags" superClass="gnu.cpp.compiler.option.dialect.flags" useByScannerDiscovery="true" value="--std=c++17" valueType="string"/>

<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="gnu.cpp.compiler.option.preprocessor.def.1497383412" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" useByScannerDiscovery="false" valueType="definedSymbols">

Expand Down
2 changes: 1 addition & 1 deletion Example/linux/.settings/language.settings.xml
Expand Up @@ -11,7 +11,7 @@

<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>

<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-756844463826323362" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-756843025223425076" id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">

<language-scope id="org.eclipse.cdt.core.gcc"/>

Expand Down
18 changes: 14 additions & 4 deletions Example/linux/src/Example.hpp
@@ -1,6 +1,7 @@
/// ConsoleTest.hpp
/// (C) 2017 Masato Kokubo

#include <complex>
#include <iostream>
#include <limits>

Expand Down Expand Up @@ -53,7 +54,7 @@ template <typename T> class Point {

/// Reutrns the hash value.
size_t hash() const {
return (size_t)(_x * 31 + _y);
return (size_t)((size_t)_x * 31 + (size_t)_y);
}
};

Expand Down Expand Up @@ -87,9 +88,18 @@ template <typename T> auto abs(const Point<T>& p) noexcept {return Point<T>(abs(
template <typename T> auto min(const Point<T>& p1, const Point<T>& p2) noexcept {return Point<T>(p1.x() <= p2.x() ? p1.x() : p2.x(), p1.y() <= p2.y() ? p1.y() : p2.y());}
template <typename T> auto max(const Point<T>& p1, const Point<T>& p2) noexcept {return Point<T>(p1.x() >= p2.x() ? p1.x() : p2.x(), p1.y() >= p2.y() ? p1.y() : p2.y());}

// Stream output
template <typename T> std::ostream& operator <<(std::ostream& stream, const Point<T>& p) {
return stream << "(x:" << p.x() << ", y:" << p.y() << ')';
// to_string
namespace std {
template <typename T>
string to_string(const Point<T>& p) {
return '(' + to_string(p.x()) + ", " + to_string(p.y()) + ')';
}

template <typename T>
string to_string(const complex<T>& comp) {
return "(real:" + to_string(comp.real()) + ", imag:" + to_string(comp.imag()) + ')';
}

}

namespace std {
Expand Down
154 changes: 133 additions & 21 deletions Example/linux/src/Example3.cpp
Expand Up @@ -19,6 +19,7 @@ void ClassA::func3() const noexcept {
const Point<int> p2(2, -3);
Point<int> p3(3, -4);
const Point<int> p4(4, -5);
const Point<int> p5(5, -6);
const Point<int>* p2p = &p2;
const Point<int>* const * const p2pp = &p2p;
const Point<int>& p2r = p2;
Expand All @@ -30,7 +31,7 @@ void ClassA::func3() const noexcept {
DEBUGTRACE_PRINT(p2p) // for Debugging
DEBUGTRACE_PRINT(**p2pp) // for Debugging
DEBUGTRACE_PRINT(*p2pp) // for Debugging
DEBUGTRACE_PRINT(p2pp) // for Debugging
// DEBUGTRACE_PRINT(p2pp) // for Debugging
DEBUGTRACE_PRINT(p2r) // for Debugging
DEBUGTRACE_PRINT(p3p) // for Debugging
DEBUGTRACE_PRINT(p1 + p2) // for Debugging
Expand All @@ -41,41 +42,100 @@ void ClassA::func3() const noexcept {
DEBUGTRACE_PRINT(p2p) // for Debugging

// std::array<T>
std::array<Point<int>, 4> array1 = {p1, p2, p3, p4};
std::array<Point<int>, 0> array0 = {};
DEBUGTRACE_PRINT(array0) // for Debugging

std::array<Point<int>, 1> array1 = {p1};
DEBUGTRACE_PRINT(array1) // for Debugging

std::array<Point<int>, 4> array2 = {p1, p2, p3, p4};
DEBUGTRACE_PRINT(array2) // for Debugging

// std::array<T1<T2>>
std::array<Point<Point<int>>, 4> array2 = {
std::array<Point<Point<int>>, 4> array2_2 = {
Point<Point<int>>(Point<int>(1, 2), Point<int>(3, 4)),
Point<Point<int>>(Point<int>(4, 5), Point<int>(6, 7))
};
DEBUGTRACE_PRINT(array2) // for Debugging
DEBUGTRACE_PRINT(array2_2) // for Debugging

// std::deque<T>
const std::deque<Point<int>> deque1 = {p1, p2, p3, p4};
const std::deque<Point<int>> deque0 = {};
DEBUGTRACE_PRINT(deque0) // for Debugging

const std::deque<Point<int>> deque1 = {p1};
DEBUGTRACE_PRINT(deque1) // for Debugging

const std::deque<Point<int>> deque4 = {p1, p2, p3, p4};
DEBUGTRACE_PRINT(deque4) // for Debugging

// std::list<T>
std::list<Point<int>> list1 = {p1, p2, p3, p4};
std::list<Point<int>> list0 = {};
DEBUGTRACE_PRINT(list0) // for Debugging

std::list<Point<int>> list1 = {p1};
DEBUGTRACE_PRINT(list1) // for Debugging

std::list<Point<int>> list4 = {p1, p2, p3, p4};
DEBUGTRACE_PRINT(list4) // for Debugging

// std::map<Key, T>
std::map<int, Point<int>> map1 = {
auto maximum_data_output_width = debugtrace::maximum_data_output_width;
std::map<int, int> map0 = {};
DEBUGTRACE_PRINT(map0) // for Debugging

debugtrace::maximum_data_output_width = 200;
std::map<int, int> map1 = {std::make_pair(1, 2)};
DEBUGTRACE_PRINT(map1) // for Debugging

std::map<int, int> map4 = {
std::make_pair(1, 2),
std::make_pair(2, 3),
std::make_pair(3, 4),
std::make_pair(4, 5)
};
DEBUGTRACE_PRINT(map4) // for Debugging
debugtrace::maximum_data_output_width = maximum_data_output_width;

// std::map<Key, T>
std::map<int, Point<int>> map2_0 = {};
DEBUGTRACE_PRINT(map2_0) // for Debugging

std::map<int, Point<int>> map2_1 = {std::make_pair(1, p1)};
DEBUGTRACE_PRINT(map2_1) // for Debugging

std::map<int, Point<int>> map2_4 = {
std::make_pair(1, p1),
std::make_pair(2, p2),
std::make_pair(3, p3),
std::make_pair(4, p4)
};
DEBUGTRACE_PRINT(map1) // for Debugging
DEBUGTRACE_PRINT(map2_4) // for Debugging

// std::map<Key, vector<T>>
std::map<Point<int>, std::vector<Point<int>>> map3_0 = {};
DEBUGTRACE_PRINT(map3_0) // for Debugging

std::map<Point<int>, std::vector<Point<int>>> map3_1 = {
std::make_pair(p1, std::vector<Point<int>>({p2, p3, p4}))
};
DEBUGTRACE_PRINT(map3_1) // for Debugging

std::map<Point<int>, std::vector<Point<int>>> map3_4 = {
std::make_pair(p1, std::vector<Point<int>>({p2, p3, p4})),
std::make_pair(p2, std::vector<Point<int>>({p3, p4, p5})),
std::make_pair(p3, std::vector<Point<int>>({p4, p5, p1})),
std::make_pair(p4, std::vector<Point<int>>({p5, p1, p2}))
};
DEBUGTRACE_PRINT(map3_4) // for Debugging

// std::map<Key, T, Compare>
const std::map<int, Point<int>, std::greater<int>> map2 = {
const std::map<int, Point<int>, std::greater<int>> map4_4 = {
std::make_pair(10, p1),
std::make_pair(20, p2),
std::make_pair(30, p3),
std::make_pair(40, p4)
};
DEBUGTRACE_PRINT(map2) // for Debugging
DEBUGTRACE_PRINT(map4_4) // for Debugging

// std::multimap<Key, T>
std::multimap<int, Point<int>> multimap1 = {
Expand Down Expand Up @@ -114,39 +174,91 @@ void ClassA::func3() const noexcept {
DEBUGTRACE_PRINT(unordered_multimap1) // for Debugging

// std::set<Key>
std::set<Point<int>> set1 = {p1, p2, p3, p4};
std::set<Point<int>> set0 = {};
DEBUGTRACE_PRINT(set0) // for Debugging

std::set<Point<int>> set1 = {p1};
DEBUGTRACE_PRINT(set1) // for Debugging

std::set<Point<int>> set4 = {p1, p2, p3, p4};
DEBUGTRACE_PRINT(set4) // for Debugging

// std::set<Key, Compare>
const std::set<Point<int>, std::greater<Point<int>>> set2 = {p1, p2, p3, p4};
DEBUGTRACE_PRINT(set2) // for Debugging
const std::set<Point<int>, std::greater<Point<int>>> set2_0 = {};
DEBUGTRACE_PRINT(set2_0) // for Debugging

const std::set<Point<int>, std::greater<Point<int>>> set2_1 = {p1};
DEBUGTRACE_PRINT(set2_1) // for Debugging

const std::set<Point<int>, std::greater<Point<int>>> set2_4 = {p1, p2, p3, p4};
DEBUGTRACE_PRINT(set2_4) // for Debugging

// std::multiset<Key>
std::multiset<Point<int>> multiset1 = {p1, p2, p3, p4};
std::multiset<Point<int>> multiset0 = {p1};
DEBUGTRACE_PRINT(multiset0) // for Debugging

std::multiset<Point<int>> multiset1 = {p1};
DEBUGTRACE_PRINT(multiset1) // for Debugging

std::multiset<Point<int>> multiset4 = {p1, p2, p3, p4};
DEBUGTRACE_PRINT(multiset4) // for Debugging

// std::multiset<Key, Compare>
const std::multiset<Point<int>, std::greater<Point<int>>> multiset2 = {p1, p2, p3, p4};
DEBUGTRACE_PRINT(multiset2) // for Debugging
const std::multiset<Point<int>, std::greater<Point<int>>> multiset2_0 = {};
DEBUGTRACE_PRINT(multiset2_0) // for Debugging

const std::multiset<Point<int>, std::greater<Point<int>>> multiset2_1 = {p1};
DEBUGTRACE_PRINT(multiset2_1) // for Debugging

const std::multiset<Point<int>, std::greater<Point<int>>> multiset2_4 = {p1, p2, p3, p4};
DEBUGTRACE_PRINT(multiset2_4) // for Debugging

// std::unordered_set<Key>
std::unordered_set<Point<int>> unordered_set1 = {p1, p2, p3, p4};
std::unordered_set<Point<int>> unordered_set0 = {};
DEBUGTRACE_PRINT(unordered_set0) // for Debugging

std::unordered_set<Point<int>> unordered_set1 = {p1};
DEBUGTRACE_PRINT(unordered_set1) // for Debugging

std::unordered_set<Point<int>> unordered_set4 = {p1, p2, p3, p4};
DEBUGTRACE_PRINT(unordered_set4) // for Debugging

// std::unordered_multiset<T>
const std::unordered_multiset<Point<int>> unordered_multiset1 = {p1, p2, p3, p4};
const std::unordered_multiset<Point<int>> unordered_multiset0 = {};
DEBUGTRACE_PRINT(unordered_multiset0) // for Debugging

const std::unordered_multiset<Point<int>> unordered_multiset1 = {p1};
DEBUGTRACE_PRINT(unordered_multiset1) // for Debugging

const std::unordered_multiset<Point<int>> unordered_multiset4 = {p1, p2, p3, p4};
DEBUGTRACE_PRINT(unordered_multiset4) // for Debugging

// std::vector<T>
std::vector<Point<int>> vector1 = {p1, p2, p3, p4};
std::vector<Point<int>> vector0 = {};
DEBUGTRACE_PRINT(vector0) // for Debugging

std::vector<Point<int>> vector1 = {p1};
DEBUGTRACE_PRINT(vector1) // for Debugging

std::vector<Point<int>> vector4 = {p1, p2, p3, p4};
DEBUGTRACE_PRINT(vector4) // for Debugging

// std::vector<std::set<T>>
std::vector<std::set<Point<int>>> setVector0x0 = {};
DEBUGTRACE_PRINT(setVector0x0) // for Debugging

// std::vector<std::set<T>>
std::vector<std::set<Point<int>>> setVector1x1 = {
{p1},
};
DEBUGTRACE_PRINT(setVector1x1) // for Debugging

// std::vector<std::set<T>>
std::vector<std::set<Point<int>>> setVector1 = {
std::vector<std::set<Point<int>>> setVector4x4 = {
{p1, p2, p3, p4},
{p2, p3, p4, p1},
{p3, p4, p1, p2},
{p4, p1, p2, p3}
};
DEBUGTRACE_PRINT(setVector1) // for Debugging
DEBUGTRACE_PRINT(setVector4x4) // for Debugging
}
11 changes: 7 additions & 4 deletions Example/macos/DebugTraceExample.xcodeproj/project.pbxproj
Expand Up @@ -126,6 +126,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
);
mainGroup = 696086F91F22F8D5007A14B7;
Expand Down Expand Up @@ -160,7 +161,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
Expand Down Expand Up @@ -195,11 +196,12 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = ../../include;
HEADER_SEARCH_PATHS = ../../../include;
MACOSX_DEPLOYMENT_TARGET = 10.12;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
STRINGS_FILE_OUTPUT_ENCODING = "UTF-8";
};
name = Debug;
};
Expand All @@ -209,7 +211,7 @@
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
Expand Down Expand Up @@ -238,10 +240,11 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = ../../include;
HEADER_SEARCH_PATHS = ../../../include;
MACOSX_DEPLOYMENT_TARGET = 10.12;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
STRINGS_FILE_OUTPUT_ENCODING = "UTF-8";
};
name = Release;
};
Expand Down
2 changes: 1 addition & 1 deletion Example/macos/src/Example.cpp
@@ -1,7 +1,7 @@
/// Example.cpp
/// (C) 2017 Masato Kokubo
#include "Example.hpp"
#include "debugtrace.hpp"
#include "../../../include/debugtrace.hpp"

DEBUGTRACE_VARIABLES

Expand Down
18 changes: 14 additions & 4 deletions Example/macos/src/Example.hpp
@@ -1,6 +1,7 @@
/// ConsoleTest.hpp
/// (C) 2017 Masato Kokubo

#include <complex>
#include <iostream>
#include <limits>

Expand Down Expand Up @@ -53,7 +54,7 @@ template <typename T> class Point {

/// Reutrns the hash value.
size_t hash() const {
return (size_t)(_x * 31 + _y);
return (size_t)((size_t)_x * 31 + (size_t)_y);
}
};

Expand Down Expand Up @@ -87,9 +88,18 @@ template <typename T> auto abs(const Point<T>& p) noexcept {return Point<T>(abs(
template <typename T> auto min(const Point<T>& p1, const Point<T>& p2) noexcept {return Point<T>(p1.x() <= p2.x() ? p1.x() : p2.x(), p1.y() <= p2.y() ? p1.y() : p2.y());}
template <typename T> auto max(const Point<T>& p1, const Point<T>& p2) noexcept {return Point<T>(p1.x() >= p2.x() ? p1.x() : p2.x(), p1.y() >= p2.y() ? p1.y() : p2.y());}

// Stream output
template <typename T> std::ostream& operator <<(std::ostream& stream, const Point<T>& p) {
return stream << "(x:" << p.x() << ", y:" << p.y() << ')';
// to_string
namespace std {
template <typename T>
string to_string(const Point<T>& p) {
return '(' + to_string(p.x()) + ", " + to_string(p.y()) + ')';
}

template <typename T>
string to_string(const complex<T>& comp) {
return "(real:" + to_string(comp.real()) + ", imag:" + to_string(comp.imag()) + ')';
}

}

namespace std {
Expand Down
2 changes: 1 addition & 1 deletion Example/macos/src/Example1.cpp
@@ -1,7 +1,7 @@
/// Example1.cpp
/// (C) 2017 Masato Kokubo
#include "Example.hpp"
#include "debugtrace.hpp"
#include "../../../include/debugtrace.hpp"

/// func1
void ClassA::func1() const noexcept {
Expand Down

0 comments on commit 9b143ea

Please sign in to comment.