The tag has no usage guidance.

learn more… | top users | synonyms

0
votes
1answer
43 views

C++ How Template Parameter Packs Work Internally [on hold]

I have a general understanding of template parameters work, but I want to know how they work. Are they like an array of typenames? If you have: template<typename... Ar> void f(const Ar&... ...
2
votes
1answer
107 views

Template Function: Passing Iterators

I am struggling with making a design choice in the following setup: I am writing (C++) functions which take a pair of iterators (to template containers) and compute a return value of the same type ...
4
votes
0answers
90 views

What is the correct place to put checking of conditions in this use case?

Here is the situation: I have a database and a class that is basically a representation of a set of fields of different tables in it. Let's call it Message. "Message" does not know of the database ...
1
vote
1answer
77 views

Templating a member name

I'm writing a library that provides graphs for search algorithms. Usually you want to rank nodes using a priority queue. Normally you want to search for an specific node in the queue and lower its ...
6
votes
1answer
173 views

Whether to abstract small repeating code segments in HTML templates?

(The framework used in question is AngularJS so the question can be translated as "Whether to introduce Directives for small repeating code segments in Views") As a developer who focuses on Java ...
19
votes
4answers
2k views

What about LISP, if anything, makes it easier to implement macro systems?

I'm learning Scheme from the SICP and I'm getting the impression that a big part of what makes Scheme and, even more so, LISP special is the macro system. But, since macros are expanded at ...
1
vote
1answer
381 views

C++ Templates where the type is a shared_ptr

When creating template classes in C++, if the type upon which the template will be specialized is intended to be a shared_ptr type, is it better to make T a shared_ptr type or make T a non-pointer ...
1
vote
1answer
181 views

C++ Template Metaprogramming and Call By Need Evaluation

I recently wrote a fairly complex C++ meta function that boils down to: template <size_t N, typename val> struct Rec { using type = typename std::conditional<N == 0, val, ...
0
votes
1answer
35 views

Scoping template variables in “has-a” (compositional) relationships

I'm developing a new templating language for PHP, and one of the features is an object-oriented approach to nested child templates. For example, I can declare an object of type HtmlBuilder like this: ...
0
votes
1answer
155 views

Bootstrap licence free template

I´m creating a new website. For that I´m using a free bootstrap template. On top of my index page I have: A Design by W3layouts Author: W3layout Author URL: http://w3layouts.com License: ...
1
vote
2answers
122 views

Why is it bad if view engines encourage logic in templates

I once read this, because I wanted to see if handlebars is the right view engine for me or rather something else. A thing that I wonder since then is the following, why is it considered bad, if a ...
39
votes
9answers
7k views

What did people do before templates in C++? [duplicate]

I am not new to programming, but I am one that started a few years ago, and I do love templates. But in the before times, how did people deal with situations where they needed compile-time code ...
1
vote
1answer
86 views

Would this be considered a plugin or template type architecture?

I would like to build a system that basically offers the option to make various APIs interchangeable for usage to the end user. For example, the person using the software would have the option of ...
2
votes
2answers
208 views

How can I get better than O(N^2) space complexity for a type sequence search?

Suppose I have a type sequence through which I want to search: template <typename...> struct TypeSequence { using type = TypeSequence; }; I want to create a metafunction Search that returns ...
4
votes
1answer
1k views

What are the main differences between C++ templates and Java generics? [closed]

I'm a beginning C++ programmer coming from Java. It feels to me that C++ templates and Java generics are actually pretty similar. You use them in pretty much the same occasions and in the same way. ...
0
votes
2answers
148 views

Can I create a type, typedef or using statement that results in a different type if instantiated a second time or more?

Suppose I have a class that evaluates some computationally intensive function: class Value { private: int eval() { mCached = ExpensiveOperation(); return mCached; } static int ...
3
votes
1answer
253 views

Augmenting functionality of subclasses without code duplication in C++

I have to add common functionality to some classes that share the same superclass, preferably without bloating the superclass. The simplified inheritance chain looks like this: Element -> ...
5
votes
2answers
1k views

where exactly should python business logic be placed in django

I have just begun to learn Django/Python/Web Development. This problem has been troubling me for a while now. I am creating an application with multiple templates in Django. I have a views.py which ...
1
vote
2answers
166 views

Is it ok to start with templates in MVC development?

I'm new to web development and I've started working on a project in my company that uses DJANGO. I feel it flexible to start my development straight first from the templates. I think it will be easier ...
28
votes
10answers
4k views

Is template “metaprogramming” in Java a good idea?

There is a source file in a rather large project with several functions that are extremely performance-sensitive (called millions of times per second). In fact, the previous maintainer decided to ...
3
votes
1answer
321 views

Use a template to get alternate behaviour?

Is this a bad practice? const int sId(int const id); // true/false it doesn't matter template<bool i> const int sId(int const id) { return this->id = id; } const int MCard::sId(int ...
3
votes
5answers
174 views

Do input template languages exist?

When I have to create some textual representation of data, I can use a template language, so that my code does not have to worry about the structure of the output file - I can sometimes even write ...
0
votes
1answer
72 views

How should templates be named? [closed]

In D I can create templates like this: template Foo(A) { A add(A a, A b) { ... } A multiply(A a, A b) { ... } A concatenate(A a, A b) { ... } } What should a template be named ideally? ...
-2
votes
1answer
253 views

Develop a website using mustache.js and PHP [closed]

I'm thinking of building a website using mustache.js to render the website and having PHP as the backend. The PHP will then mainly contain queries to the database and some SESSION checkings. ...
1
vote
1answer
187 views

heading in right direction? C++ and class templates

I'm working on some inherited code in C++ and am trying to use 2 classes with templates as I need 2-types of each class to operate on floating point or integer data (double v uint64_t to be exact). ...
0
votes
1answer
123 views

How to make C++ template stack work with basic data types and compound variables?

Templates are nice for similar algorithms of different data types. Say I make a template stack of a basic data type... Stack<int> stck(10); stck.Push(5); I'd pop it... int x = stck.Pop(); ...
3
votes
4answers
374 views

What are the perks and drawbacks of using html templates versus building the html in-code [closed]

As far as I can see there are two ways of building a html page: "inside" the language (I'll call it building for lack of a better name) or outside the language (using templates). Let me explain a bit ...
0
votes
0answers
26 views

db data to template: where to escape strings

I have an applications that queries a database, then renders a asciidoc template with data from the db, and converts the asciidoc to pdf. Now in the data there are certain characters that need to be ...
-1
votes
1answer
46 views

Load all templates at startup?

I am developing a jQuery mobile app. In this app, i often use Mustache.js templates in separate html files. Actually, every template is needed by the user, but my app loads a template (via GET method) ...
8
votes
1answer
1k views

“C++ Templates: The Complete Guide” (c) 2002 — up to date with C++11?

The book C++ Templates: The Complete Guide, (c) 2002, looks very appealing to me, but as it's 12 years old, I'm concerned it may be out of date. There are some highly favorable Amazon reviews dated ...
1
vote
3answers
1k views

Arrays vs Objects in view template

I am wondering, in view templates, what would contribute to me choosing between using arrays or objects for getting things printed out in arrays {{$user->zip_code}} vs {{$user['zip_code']}} I'm ...
1
vote
1answer
3k views

What exactly is bootstrap admin-template and how it is supposed to be used

So this is my second ASP.NET MVC 4 project. It's decided that for this one we will use this template and it was said in a way that I felt really stupid for not knowing how exactly this template will ...
2
votes
1answer
234 views

Main method templating

Now that I've gotten into a dependency injection groove, I find main methods for different applications all look basically the same. This is similar to stuff you might find on the Guice documentation, ...
3
votes
3answers
515 views

Custom PHP Template Engine

I've been developing a custom PHP template engine to suit just my needs and also to get a little more practice with PHP. What I did was to create a Template class that simply receives as constructor ...
2
votes
2answers
2k views

Why is C++ preferred over C for commercial applications? [closed]

I program in C mostly. However, it is pretty obvious that many more commercial applications are done in C++. As far as I can tell, C++ is a very complex language, with seemingly convoluted syntax and ...
2
votes
4answers
6k views

php templating with codeigniter

I am currently develop a website application in codeigniter, and I'd like to do something in PHP / CodeIgniter where I can make a common template for separate sections of the website. I was thinking ...
8
votes
2answers
932 views

How do I avoid writing lots of pass-through functions in a wrapper?

I have a class, which wraps another class of a common base type. Because the base type interface is quite large this involves writing a lot of pass-through functions. I am looking for a way to avoid ...
5
votes
1answer
2k views

Does doxygen support templates for the HTML output?

I've documented my code for doxygen, but I don't want the default HTML it gives. I know I can customize it by providing custom CSS, headers, footers, etc. (like GNOME does), and how I can add common ...
0
votes
1answer
467 views

Why does flask use Jinja2 and not xpath?

I'm just starting out with python and since I'm coming from a PHP background (thus have to adjust my mind to wrap around new concepts) one major question still stands without answer - why does Flask ...
3
votes
1answer
102 views

Custom templating in a web application

I want to understand the pros and cons in generating dynamic web application controls. The idea is to generate all the controls dynamically based on the database procedure output and populate the ...
7
votes
3answers
3k views

How do you handle increasingly long compile times when working with templates?

I use Visual Studio 2012 and he have cases where we added templates parameters to a class "just" in order to introduce a "seam point" so that in unit-test we can replace those parts with mock objects. ...
0
votes
1answer
202 views

Why should I use a web framework's template language over python's templating options?

I'm coming from a python CGI background and was wanting to move into something more contemporary and think I have decided upon web.py as the framework I would like to use. In regards to templating, ...
5
votes
1answer
115 views

How can I port msvc++ code with non-dependent names in templates to Linux?

I can deal with porting platform dependent functions. I have a problem that the compilers I tried on Linux (clang and g++) do not accept the following code, while the msvc++ compiler does: template ...
1
vote
2answers
181 views

Convert plain text to a pdf template

I have some articles (more than 200 pages) in plain text. It needs to be converted to an given PDF markup. I got some Photoshop files for the headers for every page and a list of requirements for the ...
1
vote
1answer
422 views

Heredoc or an external template file in my bash script - how it affects readibility/maintanance?

I realise that this question may be down to personal preference but I'm pretty new to Bash / shell scripting so thought it'd be worth some research to see if there's some sort of standard/best ...
5
votes
3answers
850 views

Differences betwen HTML templating systems

I'm looking at backbone.js and noticed that it supports various templating systems (they specifically refer to Mustache.js, Haml-js, and Eco, but I understand it can support even more)(like Pure and ...
2
votes
1answer
187 views

What is a “template” in Perl?

I can find all sorts of weird information about templates in Perl, but nothing about what they actually are. Are they generic types like in C++? Is it a class-like structure? Or maybe something ...
8
votes
8answers
2k views

Is STL implemented with OO?

There are several design patterns like Adaptor, Iterator implemented in STL. Does that mean STL is implemented with OO concepts? What is the relationship between OO and template parts of C++? I ...
6
votes
4answers
9k views

How to structure template system using plain PHP?

I was reading this question over on stackoverflow: http://stackoverflow.com/questions/104516/calling-php-functions-within-heredoc-strings and the accepted answer says to do plain PHP templates like ...
1
vote
3answers
621 views

Next step after creating mock-up screens

I have created some mockup screens for my app in HTML/CSS. I have 4 screens in total. They contain no client-side coding i.e. Javascript or jQuery. The screens themselves are quite bland at the ...