templates – How do I create definable type aliases that will not be reset when the scope is closed in C ++?

I'm trying to implement the class with some functionality of std :: any. In addition, I've decided to remove std :: any_cast analogue so that I can easily access the value stored in an instance of a class without specifying the type explicitly while the access is running.

I tried to use typedef Keyword, however, because the redefinition of type aliases is allowed or allowed as a constructor Operator = Range closes, the type is reset to void *,

Do you have ideas how to implement such a thing?

What I have so far is something like this:

Class arbitrary
    any (const T && other): _ptr (new T (std :: forward)(others))), t (1)
typedef T _type;
bool b = * (_typ *) _ ptr == other;
_type tmp = * (_typ *) _ ptr;
    invalid operator = (const T && other)
typedef T _type;
if (_ptr) delete _ptr;
_ptr = new T (std :: forward(other));
bool operator == (const any && rval) const
To attempt {
return * (_typ *) _ ptr == * (_typ *) rval._ptr? true wrong;
Catch (...)
return it incorrectly;
bool operator == (const any & lval) const
To attempt {
return * (_typ *) _ ptr == * (_typ *) lval._ptr? true wrong;
Catch (...)
return it incorrectly;
friend std :: ostream & operator << (std :: ostream & os, any & val);
car val ()
car a = * (_typ *) _ ptr;
Return a;
Operator Bool ()
return _ptr? true wrong;
~ any ()
delete _ptr;
typedef void * _type;
void * _ptr;
std :: ostream & operator << (std :: ostream & os, any & val)
os << val.val ();
Return os;

Well, I can just define an any_cast function for the class. However, this is not what I am looking for for my research purposes.

Every advice is appreciated.

sorting – Use deftype to create a wrapper class for byte arrays

First your calls .ba are not resolved for otherThat forces us to reflect. When you run Leincheck, you'll see:

Reflection warning, thread_test.clj: 22: 22 - Unable to resolve reference to field ba in java.lang.Object.

This can slow the method down, although it only happens once per call. The effect would not be great.

Use explicit typhoons to ensure that he is familiar with the types you work with, just as described below:

(To let[m (Alength ^ bytes (.ba ^ bytes of this))
n (alength ^ bytes (.ba ^ bytes others))

Instead, I tried to tag the parameters with the parameters, and I've received an error I've never received. I think it was looking for one Compare with With object Parameters, so the parameters were bytes threw it.

Apart from that, I do not see anything about the performance. I'll just point out, in case you do not know these& # 39; ba is actually in scope. You can use it directly, which removes part of the volume even though the code is less symmetric:

(Byte bytes) [^bytes ba]
(Compare with
    [_ other]
    (To let [m (alength ba) ; Here
          n (alength ^bytes (.ba ^Bytes other))
          l (min m n)]
      (Loop [i 0]
        (if (<i l)
(To let [a (aget ba i) ; And here
                b (aget ^bytes (.ba ^Bytes other) i)
                d (compare a b)]
            (if (null? d)
(compare with m))))))

c # – How to Create a "Hex" GameObject in Unity

So I'm doing a 3D mobile game, and I need a hex game object. Yes, I searched the entire Internet but did not find a solution (I tried to create a hex with Blender, but it did not work when I uploaded it.) It was a die for my project, not a hex, I got it saved .blender, .fbx, .obj, but none of them worked. So how can I make a hexagon object in unity?

Pay someone to create a classification essay for hypertension

We can write your literature research on types of leadership if you buy convincing research

Professional support around the clock


Write service – ORDER ONLINE

Jenna Dewan looks stylish in an olive coat and a dark blue T-shirt while running errands with her daughter. Everly trump taps critic Stephen Moore for board Seat Philip Morris that Canadian entity RBH has granted bankruptcy protection Ask, after I've been waiting for a house, can I get paid for my clients have different needs?

Unity – every time they are all used to create a random deck of 7 cards?

Coincidentally I showed this method to my students of game mechanics only this week. 🙂

One of my favorite ways to work with a deck is to use an online version of a Fisher-Yates shuffle (also known as a Knuth shuffle).

IEnumerator ShuffleBag(pars. T[] Items) {
int rest = = items.Length;

while (true) {
// Choose a random item from the rest of our deck.
// (ie the entries 0 ... remaining-1)
int drawIndex = Random.Range (0, remaining);
T drawnItem = article[drawIndex];

// Remove the item from the deck by swapping it to the end.
items[drawIndex] = Article[remaining];
items[remaining] = drawnItem;

// deliver the drawn article as our new current article,
// and wait until we are asked again to draw.
Return return drawn element;

// If we have no more cards, if we ask for a new card,
// remix the discards to create a new deck.
if (rest == 0)
remaining = article.length;

You can set this up as follows:

var bag = ShuffleBag (

Then take a new Tetromino out of your pocket:

bag.MoveNext ();
var tetromino = bag.current;

There will always be a new Tetromino ready: the bag will automatically recycle the waste as soon as it is empty, and issue it in a random new order.

How do I create a portfolio if you have no clients?

Hi Guys,

My name is Alexander and I'm from Russia.

I am a WordPress developer and an inexperienced entrepreneur. I want to start a WordPress website agency for small and medium businesses.

BUT … first and foremost I have to build a portfolio and practice on real cases. It is impossible to find customers without this step.

So I'm ready to make 7-10 websites from scratch, even for free (or a cup of coffee), but I can not find any customers anyway.

Any advice?

java – How to create a generic method that gets any entity class and start a session in hibernation?

Good night

I'm trying to create a method that retrieves an entity class and id to start a session in hibernation. The idea is to create a generic DAO to retrieve only the ID of the desired entities.

Here is the code I am trying to do:

public class GenericDAO {

public T getEntity (T entity, int id) {
Session session = zero;
Result of the project = zero;
try it
session = PoliGenericDAO.getSessionFactory (). openSession ();
Criteria crit = session.createCriteria ("HERE COMES THE GENERIC CLASS" .class);
Result = crit.uniqueResult ();
} catch (exception e) {
System.out.println ("getBasic.GenericClass.Error:" + e);
} Finally {
session.close ();
return null;


My code to get a user with an ID x is the second one:

teamModel.getUserList (). add (userDao.getUserById (user.getId ()));

And I wish it would be like this:

teamModel.getUserList (). add (genericDao.getEntity (Entity, user.getId ()));

OBS: Where in this case entity would be the user class

The idea here is to keep the number of requests to the possible bank as low as possible, as my current method from the bank gives me the full entity I need in this case.