Browse Source

Marked future changes for tracking

devel
Ludovic 'Archivist' Lagouardette 4 years ago
parent
commit
5ba9dd3ddb
13 changed files with 86 additions and 11 deletions
  1. +1
    -0
      include/gp/flat_tree.hpp
  2. +1
    -0
      include/gp/memory.hpp
  3. +71
    -3
      include/gp/optional.hpp
  4. +1
    -0
      include/gp/subtree_iterator.hpp
  5. +1
    -1
      include/indexed_array.hpp
  6. +1
    -1
      include/rc6_generic.hpp
  7. +1
    -1
      include/region_locker.hpp
  8. +2
    -0
      include/shared_fd.hpp
  9. +1
    -1
      include/shared_mmap.hpp
  10. +2
    -1
      include/stored_array.hpp
  11. +1
    -1
      include/stored_clog.hpp
  12. +1
    -1
      include/stored_hmap.hpp
  13. +2
    -1
      include/stored_indexed_array.hpp

+ 1
- 0
include/gp/flat_tree.hpp View File

@ -2,6 +2,7 @@
#include <gp/array.hpp>
#include <gp/iterator.hpp>
#include <gp/integer_math.hpp>
// UNIMPLEMENTED: see filename
template<typename T, size_t depth>
class flat_tree {

+ 1
- 0
include/gp/memory.hpp View File

@ -2,6 +2,7 @@
#include "gp_config.hpp"
#include "gp/exception.hpp"
#include <type_traits>
// XXX: THIS FILE SHOULD BE REMOVED, AS SHOULD ALL DEPENDENCIES ON THE C-ALLOCATOR AS IS
namespace gp{
template<class T, typename I = std::enable_if_t<gp_config::memory_module::is_ok,int>>

+ 71
- 3
include/gp/optional.hpp View File

@ -2,6 +2,7 @@
#include <type_traits>
#include "gp_config.hpp"
#include "gp/exception.hpp"
#include "gp/algorithm/move.hpp"
#include "gp/memory.hpp"
namespace gp{
@ -9,6 +10,7 @@ namespace gp{
constexpr nullopt_t nullopt;
// TODO: Add allocators to the template
template<typename T, bool B = std::is_final<T>::value || std::is_fundamental<T>::value>
class optional;
@ -34,9 +36,38 @@ namespace gp{
constexpr optional(T&& value)
: ready{true}
{
new(buffer) T(std::move(value));
new(buffer) T(gp::move(value));
}
optional operator=(nullopt_t) {
if(ready) {
((T*)buffer)->~T();
ready = false;
}
return *this;
}
optional operator=(T& value) {
if(ready) {
*(T*)buffer = value;
} else {
ready = true;
new(buffer) T(value);
}
return *this;
}
optional operator=(T&& value) {
if(ready) {
*(T*)buffer = gp::move(value);
} else {
ready = true;
new(buffer) T(gp::move(value));
}
return *this;
}
constexpr bool has_value()
{
return ready;
@ -50,11 +81,14 @@ namespace gp{
{
throw bad_optional{};
}
} else {
gp_config::assertion(ready, "bad optional access");
}
return *reinterpret_cast<T*>(buffer);
}
};
// TODO: Add allocators to the template
template<typename T>
class optional<T,false>{
bool ready = false;
@ -68,16 +102,48 @@ namespace gp{
: ready{false}
{}
// TODO: Add typesafe generic assignment
constexpr optional(T& value)
: ready{true}
{
ptr = (void*)new T(value);
ptr = (void*)new T(value); // TODO: Use allocators
}
// TODO: Add typesafe generic assignment
constexpr optional(T&& value)
: ready{true}
{
ptr = (void*)new T(std::move(value));
ptr = (void*)new T(gp::move(value)); // TODO: Use allocators
}
optional operator=(nullopt_t) {
if(ready) {
delete (T*)ptr;
ready = false;
}
return *this;
}
// TODO: Add typesafe generic assignment
optional operator=(T& value) {
if(ready) {
*(T*)ptr = value;
} else {
ready = true;
ptr = (void*)new T(value); // TODO: Use allocators
}
return *this;
}
// TODO: Add typesafe generic assignment
optional operator=(T&& value) {
if(ready) {
*(T*)ptr = gp::move(value);
} else {
ready = true;
ptr = (void*)new T(gp::move(value)); // TODO: Use allocators
}
return *this;
}
constexpr bool has_value()
@ -93,6 +159,8 @@ namespace gp{
{
throw bad_optional{};
}
} else {
gp_config::assertion(ready, "bad optional access");
}
return *reinterpret_cast<T*>(ptr);
}

+ 1
- 0
include/gp/subtree_iterator.hpp View File

@ -2,6 +2,7 @@
#include <stddef.h>
#include <stdint.h>
#include <gp/buffer.hpp>
// UNIMPLEMENTED: see filename
template<typename T>
struct subtree_iterator final

+ 1
- 1
include/indexed_array.hpp View File

@ -1,2 +1,2 @@
#pragma once
// UNIMPLEMENTED: see filename

+ 1
- 1
include/rc6_generic.hpp View File

@ -4,7 +4,7 @@
#include <gp/integer_math.hpp>
#include <algorithm>
#include <array>
// BUG: A proper investigation is required to fix this file so that it gives the correct output.
template<typename word_t = uint32_t, size_t r = 20, size_t b = 128, word_t P = 0xb7e15163L, word_t Q = 0x9e3779b9L>

+ 1
- 1
include/region_locker.hpp View File

@ -1,2 +1,2 @@
#pragma once
// UNIMPLEMENTED: see filename

+ 2
- 0
include/shared_fd.hpp View File

@ -14,6 +14,8 @@
#include <variant>
#include <cassert>
// TODO: Scavenge for useful parts and discard
namespace gp{
using open_opt_flags = int;

+ 1
- 1
include/shared_mmap.hpp View File

@ -1,2 +1,2 @@
#pragma once
// UNIMPLEMENTED: see filename

+ 2
- 1
include/stored_array.hpp View File

@ -1 +1,2 @@
#pragma once
#pragma once
// UNIMPLEMENTED: see filename

+ 1
- 1
include/stored_clog.hpp View File

@ -1,2 +1,2 @@
#pragma once
// UNIMPLEMENTED: see filename

+ 1
- 1
include/stored_hmap.hpp View File

@ -1,2 +1,2 @@
#pragma once
// UNIMPLEMENTED: see filename

+ 2
- 1
include/stored_indexed_array.hpp View File

@ -1 +1,2 @@
#pragma once
#pragma once
// UNIMPLEMENTED: see filename

Loading…
Cancel
Save