a design structure for creating several things that are almost identical but need different values. Not template-meta-programming.

learn more… | top users | synonyms

1
vote
0answers
17 views

Python html Page reporter

My program, page_reporter, attempts to port scan a network and identify servers hosting web pages. From here it will create an HTML report using iframes to give you a snapshot of what the page looks ...
1
vote
0answers
10 views

Modular widget that minimizes js and css scope pollution

So, my goal with this is to create a simple login widget that does as close to nothing to the global scope as possible. The login mechanism is less important than the encapsulation. The whole script ...
4
votes
0answers
21 views

implementing a StringEnum

this is to be used like an Enum (as parameter mostly), but for string using .net 3.5 Actual Implementation ...
1
vote
1answer
44 views

A variadic tree class that supports multiple types

I'll define template <typename...> class VariadicTree with the following example: ...
3
votes
0answers
49 views

Thread-safe LRU cache for C++

I'm working on a simple LRU cache for C++. There's nothing spectacular or unusual about it, but I would like it to be thread safe. (I'm going to be using this for ...
2
votes
1answer
76 views

Auto-resizing array, that accepts negative indexes

I've been coding a helper container template to contain tiles in 2D games. What I figured out I would like when writing code for my games is forgetting all resize stuff, allowing negative indexes (for ...
2
votes
3answers
81 views

C++ Node class template

I'm working on building understanding of data structures in general, and specifically linked lists in this example. I'm also trying to increase my ability with templates. In cross-referencing dozens ...
1
vote
2answers
44 views

Storing and loading functions

The class Functions can store/load any functions. It does this by assigning a unique name to every function that gets added. You can then call the function by ...
1
vote
1answer
27 views

Handler for incoming network packages

I want to let you look through my NetHandler which is basically the component which gets notified when a full packet arrived (not like tcp-packet but my own type of ...
2
votes
0answers
44 views

Any class implementation - follow-up

Based on the previous question, I have improved it to make it insert regular function. Also, I have implemented a new template approach to obtain the signature from any function by testing its ...
3
votes
0answers
57 views

Enum to string with template metaprogramming

This allows enum values to be outputted as strings. But enum_strings is a type, not a map or a vector, so if the enum value is known during compile time, there ...
4
votes
1answer
45 views

A “policy-based” design for a generic CUDA kernel

I am faced with a design issue that has been discussed on SO several times, the most similar question being this one. Essentially, I want polymorphism for a CUDA kernel in the form of a "generic" ...
4
votes
1answer
57 views

A class to encapsulate a pair of ints with range-checking

The goal is to have a helper class to wrap the concept of a resolution safely, encapsulating the range check into the class, since otherwise it can get lost by a client not so cautious. I think this ...
3
votes
0answers
51 views

C++ time types and format conversions

I wrote a small header-only C++11 header for converting between various C++ time formats. Here's the code in question: ...
2
votes
1answer
20 views

Liquid navigation tree generator

This include was written for a Jekyll site I'm building. It generates nested HTML unordered lists to a given depth dynamically by parsing page urls. It works fine, but the code feels messy and it ...
3
votes
3answers
70 views

Template 3d vector class

I've created this 3D vector class and would like it to be reviewed. I wonder if there are still some improvements that can be made. This is a header only implementation. ...
5
votes
0answers
86 views

Custom PHP Templating System

I recently decided to see if I could make a functioning templating system. It works, but I feel like it is not all that great. What I'm looking for here is just general critique or ideas to improve. ...
3
votes
1answer
94 views

C++ template Partial Specialization Member Function; Am I doing right?

I'm trying to improve my C++ template metaprogramming skills. From my understanding, I can't partially specialize a function(either member function or not). So, I need to define another class that can ...
2
votes
1answer
51 views

Convert custom format to XML Template

I have just finished writing a simple Python3 program which converts a custom input file (or multiple files within the same folder) to an XML template. It works as it is, but I think that I somehow ...
2
votes
1answer
33 views

Rendering comments in a Backbone view

I want to make show/hide logic more maintainable in my codebase. Because they are too faraway located in separate js files, it hard for people to maintain. The flow in my codebase is: ...
2
votes
0answers
45 views

Class templates for encapsulation of datasheet limits

I've written some classes to encapsulate the limits given for datasheet parameters, e.g. for the classic 741 op amp: As the above example datasheet snippet shows, there are some challenges for ...
2
votes
2answers
131 views

Efficiency of vector like class

I've written a vector-like class in C++ and I'm trying to figure out issues in efficiency. When I use clock() to measure the time taken to emplace objects, ...
3
votes
0answers
38 views

Implementing a templated Array class

I have implemented an Array class using templates. I have used a std::allocator object for memory allocation. Will it be better to use operator new along with placement new for memory allocation? ...
3
votes
1answer
80 views

C++ Template Binary Search Tree

I've been trying to improve my C++ skills as well as work on some general coding techniques so I've attempted to build my first binary search tree in C++ using templates. I've mostly done Java ...
1
vote
1answer
49 views

Generic implementation of SiftUp/Down operations on binary heap

Binary heap construction and maintenance boil down to the two basic operations: sift up and sift down. Following are generic template implementations of the two operations. Any comments are welcome. ...
3
votes
3answers
84 views

Bit manipulation tool set

I made a tool set to facilitate bit manipulation as follows. Any comments are welcome, be it about the interface design, the implementation, or even the naming. Also, I want to make sure that the tool ...
1
vote
1answer
68 views

Set openCV basic structures to zero in a unique way

For test cases I need a unique way to set any structure to zero. For openCV I wrote this: ...
3
votes
1answer
90 views

Minimalist Tree

While working on a small project, I tried to implement a super simple tree class in C++. It supports an arbitrary number of branches from each node. In addition to general comments, my main concerns ...
3
votes
1answer
40 views

C++ Template for one to many Registration (pre Gang of Four)

I use this template to lookup clients registered for data. The data is associated by name(key) and clients are shared pointers (value) to a class which will consume the data. ...
0
votes
1answer
69 views

HTML template for win-loss data in Javascript with Mustache

Can anyone suggest a better way to implement my template code? ...
3
votes
0answers
72 views

Console Command module (in-game console or base for script engine)

I've created a console/terminal command handling module that allows the programmer to bind functions to a command name and later execute them from std::string. What's new is that it handles most stuff ...
2
votes
2answers
122 views

Template Binary Search Tree

This is a simple binary search tree implementation written with C++'s templates feature I wrote to learn C++. What improvements would make this cleaner and better as far as C++ practices go, and are ...
4
votes
1answer
84 views

CakePHP change 'miniMap' action and respect template

I have some questions on how I can improve this "action" (method) in "controller": My template has a navbar with dynamic content (if the user is logged in a special button appears, his name appears ...
5
votes
2answers
91 views

Attempt at templates by creating a class for N-dimensional mathematical vectors

Originally I had tried to implement this topic after having learned about Inheritence and posted it on here, but that forced complexity and the main suggestion was that this was ideal for templates. ...
6
votes
1answer
76 views

Text substitution templating function

In a recent interview I was asked to solve the below problem. Problem: Given a string with variables in them, e.g. ...
12
votes
1answer
166 views

Simple Python 3 templating module

The module adds syntactic sugar to Python 3 to allow concise specification of templates. I use it to generate a collection of static web pages from various data sources. I wanted something ...
1
vote
0answers
18 views

Better way to template in simple coffee script

I am looking to see if there is a better way to refactor the creatMessage such that the logic of identifying message elements is outside the actual message ...
3
votes
1answer
126 views

N-ary heap implementation

NaryHeap as a generalization of binary heap. Each node has up to N children. A template specialization for N = 2 (BinaryHeap) ...
5
votes
1answer
200 views

Type erasure and deferred function calls for any function

1. Description 1.1. Functionality The objective of these types is to provide type erasure for any function while maintaining the ability to provide a return value through a combination of ...
14
votes
1answer
261 views

Template UserForm Input - launch, input, validation, error handling

I'm building a template [Process-Tracker] spreadsheet. The idea is that, for any process where we can define what steps should occur in what order (and preferably, how far apart), there will be a ...
0
votes
1answer
65 views

Designing a generic C++1z class [closed]

I'm designing a generic interface for a MessageEntry class for a .h file. I'm looking for guidance on form and terminology (would I call this an interface/template/generic class?): ...
3
votes
0answers
183 views

C++ Finite State Machine - follow-up

This question is a follow-up from Object Oriented Finite State Machine. I vastly improved commenting and followed the suggestions from the answer. Additionally, I improved my tests and did some more ...
2
votes
1answer
142 views

Object Oriented Finite State Machine

I wrote a little library for myself: implementing a generic finite state machine. I will be using this library in class assignments. I clearly have little understanding of C++ templates because most ...
1
vote
0answers
69 views

Specialized template methods with complex numbers class

Suppose I have a class of complex numbers called Complex and I wish to implement a class of generic matrices with transpose operation. ...
2
votes
2answers
316 views

C++ Optional Implementation

I haven't done much programming in C++, so I figured I'd try making an Optional class. I'm mainly concerned that I didn't follow good conventions or that I didn't ...
7
votes
2answers
223 views

SQL code reuse with C#

I have some code that allows for SQL reuse for C#. I'm pretty happy with it, but the fact that I can't find anything similar on the web makes me think I'm going about it the wrong way. I have a GitHub ...
2
votes
0answers
48 views

Extremely redundant HTML templating

This is horrendous. I'm using lodash's templating engine for this table. Here's the template for an individual record's row. I've got 5 different table and ...
10
votes
3answers
3k views

C++ Stack using template

I'm learning C++, so I wrote a stack with the help of templates. I'm wondering if there is anything I can improve or if I did something vastly wrong. Stack.h ...
10
votes
3answers
522 views

Fastest possible text template for repeated use?

While reviewing Sending templatized e-mail to a million contacts, I wrote this implementation to illustrate an alternate approach. It is designed to be the fastest possible way to generate templated ...
4
votes
1answer
58 views

Making my underscore template code more manageable

I currently have what seems to be a very overly complicated underscore template full of conditionals and as the data grows I'm worried the conditions are going to get more and more extreme. Can anyone ...